IPhone开发笔记-windows下Object-c编译环境

新的工作,新的方向,现在开始朝移动平台方向发展了,今年的目标的是在IPhone开发上成为熟练的“码农” :) 。

还没上班呢,传说中的mac book也没领到手(咽下口水先~~),只好先在windows下弄个object-c的编译环境下,因为xcode用的也是gcc的编译器,所以理论上任何平台都是可以编译object-c的,具体步骤如下:

1. 搭建GNUStep
    http://www.gnustep.org/experience/Windows.html 在这里下载前面三个,GNUstep MSYS System,GNUstep Core,GNUstep Devel,不多说了,全部装好就是了。

2. 编写helloworld
    object-c用的是.m作为默认的后缀,这里是helloworld.m,简单的写下代码:

 

  
    
#import < Foundation / Foundation.h >

int main( char argc, char * argv[]) {
NSLog(
@" hello world " );
return 0 ;
}

 

 


3. 编译exe
    这个是挺麻烦的,我也没多仔细弄,随便网上找了个,反正马上要用上xcode的,方便期间在home目录下建立一个sh文件,加入下面的代码。然后在开始-程序-Gnustep-shell,打开shell,运行sh,正常的话exe就该出来了。

  
    
# !/ bin / sh

gcc
- o helloworld helloworld.m \
- fconstant - string - class = NSConstantString \
- I / GNUstep / System / Library / Headers / \
- L / GNUstep / System / Library / Libraries / \
- lobjc \
- lgnustep - base

 

你可能感兴趣的:(iPhone开发)