您的位置:首页 > 移动开发 > Objective-C

object-c ubuntu下开发环境搭建

2016-01-04 14:21 465 查看
1. 安装gnustep和gobjc

sudo apt-get install gnustep gnustep-devel gobjc

2. 示例代码
#import <Foundation/Foundation.h>

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

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


3. 编译

gcc `gnustep-config --objc-flags` hello.m -o hello -lgnustep-base

4. 运行

./hello

运行结果如下:

2016-01-04 14:16:03.705 hello[2405] hello world

参考:http://www.techotopia.com/index.php/Installing_and_Using_GNUstep_and_Objective-C_on_Linux
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: