我在Ubuntu 12無法鐺中找到objc.h編譯
我試圖編譯使用鐺一個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錯誤?
geremy @雙重:〜$定位objc.h /usr/lib/gcc/x86_64-linux-gnu/4.6/include/objc/objc.h但我不認爲這是正確的。我相信我需要:https://github.com/gnustep/gnustep-libobjc2安裝呢? – Geremy 2012-07-13 17:24:36
/usr/lib/gcc/x86_64-linux-gnu/4.6/include/objc/objc.h是GCC objc運行時。嘗試安裝gnustep-libobjc2。該makefile應該將運行時放置在/ usr/local中。然後,使用帶clang的參數-lobjc來使用gnustep運行時。 – jtomschroeder 2012-07-13 17:52:43
我認爲這是同樣的問題,它適用於我。 Ubuntu 12.04。 http://ubuntuforums.org/showthread.php?t=1412542 – 2012-10-19 17:59:33