Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选 PDF转换器

首页 / 操作系统 / Linux / 在GNUStep上编译和执行Objective-C

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 <Foundation/Foundation.h> 
 
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