I’m trying to port a game to iOS but I’m having a problem. I have a class called CKSprite with the following method:
- (id)initWithFile:(NSString *)fileName effect:(GLKBaseEffect *)effect
{
if ((self = [super init]))
{
//some stuff
}
return self;
}
I then have a subclass called CKPLayer (it has no other methods or properties at the moment other than what it inherits:
@property (strong) CKPlayer *player1;
But when I try to initialise it using the parent method:
self.player1 = [[CKPlayer alloc] initWithFile:@"Images/parrot.png" effect:self.effect];
I get this error:
Undefined symbols for architecture i386:
“_OBJC_CLASS_$_CKPlayer”, referenced from:
objc-class-ref in CKViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is my first time trying to do anything like this so I’ve probably done something stupid.
Any help will be greatly appreciated.
#import "CKSprite.h"
@interface CKPlayer : CKSprite
@end
The linker is missing the implementation for the class CKPlayer. Maybe you just forgot to implement it since it has “no other methods or properties at the moment”, in that case just add a file which should look like:
and ld should be happy