我想为ubuntu安装objective c编译器。
该站点用于在 ubuntu 上安装 GNUstep。
http://www.techotopia.com/index.php/Installing_and_Using_GNUstep_and_Objective-C_on_Linux
然后在终端中按以下顺序编写命令-
sudo apt-get install gnustep
sudo apt-get install gnustep-devel
然后,我编写了我的示例代码并将其保存为 hello.m
#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.
gcc `gnustep-config --objc-flags` -lgnustep-base hello.m -o hello
然后,出现一条错误消息
gcc: gnustep-config --objc-flags: No such file or directory
hello.m:1:23: fatal error: Foundation.h: No such file or directory
compilation terminated.
然后,我写了
sudo apt-get install gobjc
然后,终端显示
Reading package lists... Done
Building dependency tree
Reading state information... Done
gobjc is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 205 not upgraded.
然后,我再次编译,但它再次显示相同的错误。
hp@ubuntu:~$ gcc 'gnustep-config --objc-flags' -lgnustep-base hello.m -o hello
gcc: gnustep-config --objc-flags: No such file or directory
hello.m:1:23: fatal error: Foundation.h: No such file or directory
compilation terminated.
所以,需要一些帮助..