0
我试图编译XCode中一个微不足道的命令行工具:链接错误,同时访问NSSpeechSynthesizer
#import <Cocoa/Cocoa.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
//NSSpeechSynthesizer *speeker = [[NSSpeechSynthesizer alloc] initWithVoice: nil];
NSLog(@"%@", [NSSpeechSynthesizer availableVoices]);
NSLog(@"Hello, World!");
[pool drain];
return 0;
}
甚至想到我进口Cocoa.h,我得到一个链接错误:
Undefined symbols:
"_OBJC_CLASS_$_NSSpeechSynthesizer", referenced from: objc-class-ref-to-NSSpeechSynthesizer in byc.o ld: symbol(s) not found collect2: ld returned 1 exit status
任何人都知道发生了什么?
Peter,对于这个愚蠢的问题感到抱歉,但我应该在哪里添加此选项?我试图打开项目设置,但无法在链接器部分找到合适的位置。 O :-) – cfischer 2010-11-05 18:39:40
没关系,我找到了。这比我想象的要容易:只需将可可框架添加到“外部框架和库”组中即可。 – cfischer 2010-11-05 18:45:10
顺便说一句,以下是如何做到这一点,以防其他人需要此信息:http://wiki.remobjects.com/wiki/Linking_Custom_Frameworks_from_your_Xcode_Projects – cfischer 2010-11-05 18:46:08