Objective c 在编译过程中找不到objc.h

Objective c 在编译过程中找不到objc.h,objective-c,linux,clang,gnustep,Objective C,Linux,Clang,Gnustep,我在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]; ret

我在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;
}
我得到以下错误:

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.
clang:警告:编译期间未使用参数:'--param ssp buffer size=4'
在h.m:1中包含的文件中:
在/usr/include/GNUstep/Foundation/Foundation.h:30中包含的文件中:
在/usr/include/GNUstep/GNUstepBase/GSVersionMacros.h:193中包含的文件中:
在/usr/include/GNUstep/GNUstepBase/GSConfig.h中包含的文件中:229:
/usr/include/GNUstep/GNUstepBase/preforce.h:112:11:致命错误:“objc/objc.h”
找不到文件
#包括
^
生成1个错误。
使用gcc的相同命令行也可以正常工作


你知道如何修复这个丢失的objc.h错误吗?

obj-c.h是Objective-c运行时的一部分,你安装了吗?根据我自己的经验,GNUstep在大多数平台上似乎都受到了伤害,因此可能只是GNUstep的配置脚本拒绝接受它,即使它已安装,如果您无法在此处获得更好的答案,请尝试他们的邮件列表

该头作为ObjC运行时的一部分出现。虽然GCC提供了一个runitme(虽然只有一个没有像ARC这样的现代特性),但Clang/LLVM并不支持这样的运行时。如果您想使用Clang,您需要安装GNUstep的ObjC运行时,您可以在这里找到:

对于Ubuntu,GNUstep wiki上提供了bash脚本,可以帮助您完成有些复杂的GNUstep安装过程:

还有一个提示:您不应该像以前那样试图通过手动使用编译器来重新发明gnustepmake。更好地使用GNUstep make:


geremy@dually:~$locate objc.h/usr/lib/gcc/x86_64-linux-gnu/4.6/include/objc/objc.h但我认为这不是正确的。我认为我需要:安装?/usr/lib/gcc/x86_64-linux-gnu/4.6/include/objc/objc.h是gcc-objc运行时。尝试安装gnustep-libobjc2。该生成文件应将运行时放置在/usr/local中。然后,使用参数-lobjc with clang来使用gnustep运行时。ubuntu 12.04。
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.