在GNUStep上编译和执行Objective-C

2014-11-24 10:41:29 ? 作者: ? 浏览: 0

1. 以下是你的Objective-C源文件 (hello.m)


include $(GNUSTEP_MAKEFILES)/common.make

TOOL_NAME = hello
hello_OBJC_FILES = hello.m

include $(GNUSTEP_MAKEFILES)/tool.make


2. 准备如下makefile,并命名为GNUmakefile


#import

int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

NSLog (@"hello world");
[pool drain];
return 0;
}


3. 编译


$ make
This is gnustep-make 2.6.1. Type 'make print-gnustep-make-help' for help.
Making all for tool hello...
Compiling file hello.m ...
Linking tool hello ...


4. 执行


$ ./first
Welcome to Objective-C





-->

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: