我正在使用 TextMate 做一些 Objective-C 练习。当所有内容都在一个文件中时,它可以正常工作,但是一旦我想使用多个文件,它就会出错。例如,我有一个单独的Rectangle.h
文件要导入:
#import "Rectangle.h"
int main (int argc, char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Rectangle *rectangle = [[Rectangle alloc] init];
[pool drain];
return 0;
}
运行给出了这个错误:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Rectangle", referenced from:
objc-class-ref in ccccStDD.o
ld: symbol(s) not found for architecture x86_64
我正在使用 C 包的“运行”命令。使用 Xcode 包的“构建和运行”命令会给我一个不同的错误。
如何让 TextMate 导入我的Rectangle.h
文件并运行?