存档
首先,我们要安装相应的程序: apt-get install gcc gobjc gcc g++ gnustep libgnustep-gui-dev 然后编写一个hello.m文件: 连hello.m都是抄来的,哈哈,程序如下: #import <Foundation/Foundation.h> @interface HelloWorld : NSObject – (void) hello; @end @implementation HelloWorld – (void) hello { NSLog(@”hello world!”); } @end int main(void) { HelloWorld *hw = [[HelloWorld alloc] init]; [hw hello]; [hw release]; } 然后就是编译了: 编译成.o文件: gcc -fconstant-string-class=NSConstantString -I /usr/include/GNUstep/ -c hello.m 链接: [...]
八 12th, 2010 | Filed under 开发