$ cat helloworld.m
$ gcc -fconstant-string-class=NSConstantString -I /GNUstep/System/Library/Headers/ -c helloworld.m
bruce.lin.chn@lion ~
$ gcc -o helloworld helloworld.o -L /GNUStep/System/Library/Libraries/ -lobjc -
lgnustep-base
bruce.lin.chn@lion ~
$ ./helloworld.exe
2011-07-15 13:05:55.542 helloworld[4336] 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;
}bruce.lin.chn@lion ~$ gcc -fconstant-string-class=NSConstantString -I /GNUstep/System/Library/Headers/ -c helloworld.m
bruce.lin.chn@lion ~
$ gcc -o helloworld helloworld.o -L /GNUStep/System/Library/Libraries/ -lobjc -
lgnustep-base
bruce.lin.chn@lion ~
$ ./helloworld.exe
2011-07-15 13:05:55.542 helloworld[4336] Hello World!
GCC编译HelloWorld程序
本文展示了一个使用GCC编译器编译简单的HelloWorld程序的过程。该程序采用Objective-C语言编写,并通过一系列命令行操作完成从源代码到可执行文件的整个编译流程。
1848

被折叠的 条评论
为什么被折叠?



