Objective-c_搭建windows下编程环境

http://www.gnustep.org/experience/Windows.html
下载并安装下列3个文件到D:\GNUstep
1,安装	gnustep-msys-system-0.28.1-setup.exe
2,安装	gnustep-core-0.28.0-setup.exe
3,安装 gnustep-devel-1.4.0-setup.exe


4,运行D:\GNUstep\msys.bat,弹出console窗口,可以使用Linux命令了(ls,pwd,cd,mkdir等)

5,在D:\GNUstep\home下新建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;
}

6,在D:\GNUstep\home下新建auto.sh

gcc -o "$1" "$2" -I/GNUstep/System/Library/Headers -fconstant-string-class=NSConstantString -

L/GNUstep/System/Library/Libraries -lobjc -lgnustep-base

7,在GNUstep的console窗口命令行下  
	1,cd ..		(回到上级目录,即D:\GNUstep\home目录,因为默认进入时在Administrator目录)
	2,auto.sh hello hello.m
	3,运行生成的hello.exe
至此hello.exe编译并成功运行,输出Hello World!


你可能感兴趣的:(Objective-C,环境搭建)