我在Ubuntu 12上.
我正在尝试使用clang编译Objective-C hello_world应用程序.这是来源:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog (@"hello world");
[pool drain];
return 0;
}
我用这个命令行:
. /usr/share/GNUstep/Makefiles/GNUstep.sh
clang h.m `gnustep-config --objc-flags` -lgnustep-base -o hello
我收到以下错误:
clang: warning: argument unused during compilation: '--param ssp-buffer-size=4'
In file included from h.m:1:
In file included from /usr/include/GNUstep/Foundation/Foundation.h:30:
In file included from /usr/include/GNUstep/GNUstepBase/GSVersionMacros.h:193:
In file included from /usr/include/GNUstep/GNUstepBase/GSConfig.h:229:
/usr/include/GNUstep/GNUstepBase/preface.h:112:11: fatal error: 'objc/objc.h'
file not found
#include <objc/objc.h>
^
1 error generated.
使用gcc的相同命令行工作正常.
任何想法如何解决这个丢失的objc.h错误?
最佳答案 obj-c.h是Objective-C运行时的一部分,你安装了吗?根据我自己的经验,GNUstep在大多数平台上似乎都是一个受伤的世界,所以它可能只是GNUstep的配置脚本,即使安装它也拒绝接收它,如果你在这里找不到更好的答案,请尝试他们的邮件列表.