Hebbian
Hebbian

Reputation: 344

Basic Cocos2D troubleshooting

A basic question, I just wanted to change the runWithScene: method in AppDelegate.m to [GameScene node]. I created the GameScene class, and created the instance var of my GameLayer class on it, and I found this error, which is annoying :

Undefined symbols: "_OBJC_CLASS_$_GameLayer", referenced from: objc-class-ref-to-GameLayer in GameScene.o ld: symbol(s) not found collect2: ld returned 1 exit status

And here's my GameScene code :

GameLayer *GameLayer; GameLayer = [GameLayer node];

Any help appreciated.

Upvotes: 0

Views: 103

Answers (2)

YvesLeBorg
YvesLeBorg

Reputation: 9079

Make certain your GameLayer class is included in your target. Show the utilities (right hand side, top, the View button). After, click in the project navigator on your GameLayer.m module. The Target Membership is show in the utilies. If the target is not clicked there, the GameLayer class does not get compiled (ie no errors), thus the linker does not find the object module.

Upvotes: 1

MCKapur
MCKapur

Reputation: 9157

Seems like you have not imported GameLayer class. At the top of the implementation, next to the import statements, add:

#import "GameLayer.h"

UPDATE:

Ok, I think I know whats happening. You have to compile your sources. Go to Project Settings then the project target, then Build Phases and finally add GameLayer to the drop down list "Compile Sources".

Upvotes: 0

Related Questions