Ubuntu14.04 Objective-C hello world

半腔热情 提交于 2019-11-27 00:17:41

1. Install GNUstep

sudo apt-get install gnustep gnustep-devel

2. Write hello world program, and save as 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;
}

3. Set GNUstep compile enviroment

. /usr/share/GNUstep/Makefiles/GNUstep.sh

4. Compile 

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

  

转载于:https://www.cnblogs.com/jmax/p/3764136.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!