retrotron
thinking is design
I'm trying to run a simple HelloCocoa class, but I'm running into troubles. For simplicity's sake, I've got the @interface, @implementation, and main( ) in main.m. I compile with
in the terminal and I get this error:
Can somebody tell me what I'm doing wrong?
Here's the contents of main.m:
Code:
cc main.m -o prog1
Code:
ld: Undefined symbols:
.objc_class_name_Object
.objc_msgSend
Here's the contents of main.m:
Code:
// a basic class
#import <objc/Object.h>
#import <stdio.h>
// --------- @interface ------------- //
@interface HelloCocoa: Object {
int someVar;
}
- (void) print;
@end
// --------- @implementation -------- //
@implementation HelloCocoa;
- (void) print {
printf("\nHello Cocoa...mmm...yummy.\n");
}
@end
// ---------- try it out ------------ //
int main (int argc, char *argv[]) {
HelloCocoa *cupOfCocoa;
cupOfCocoa = [[HelloCocoa alloc] init];
[cupOfCocoa print];
[cupOfCocoa free];
return 0;
} // end main()