본문 바로가기

카테고리 없음

Objective-C 크로스 컴파일 방법

<패키지 설치>

sudo apt-get install gnustep

sudo apt-get install gnustep-devel

<Sample code>

#import <Foundation/Foundation.h>

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

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

<컴파일 환경 구성>

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

<컴파일>

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

<실행>

./hello

2020-02-19 16:04:39.658 hello[3742:3742] hello world