Showing all posts tagged #objective-c:



Objective-C Setup

Posted on February 11th, 2014

[Ubuntu setup]
  1. apt-get install gobjc build-essential
  2. hello.m
    #import

    @interface HelloWorld : NSObject
    - (void) hello;
    @end

    @implementation HelloWorld
    - (void) hello {
    NSLog(@"hello world!");
    }
    @end

    int main(void) {
    HelloWorld *hw = [[HelloWorld alloc] init];
    [hw hello];
    [hw release];
    }
  3. gcc -x objective-c -I/usr/include/GNUstep -fconstant-string-class=NSConstantString -D_NATIVE_OBJC_EXCEPTIONS hello.m -lgnustep-base
    or
    gcc $(gnustep-config --objc-flags) hello.m $(gnustep-config --base-libs)
  4. From: http://www.gc3.uzh.ch/blog/Compile_a_Objective-C_application_on_Ubuntu___40__Hobbes_instance__41__/
[MAC Setup]
  1. gcc -o hello hello.m -framework Foundation
[Window Setup]
  1. Download the packages from http://www.gnustep.org/experience/Windows.html
  2. Install the packages step by step : GNUstep MSYS System, GNUstep Core, GNUstep Devel, GNUstep Cairo,ProjectCenter,Gorm.
  3. Enter the GNUstep shell : C:\GNUstep\msys\1.0\msys.bat
  4. The root folder is C:\GNUstep\msys\1.0
  5. Compile : gcc -o hello hello.m -I /GNUstep/System/Library/Headers \
    -L /GNUstep/System/Library/Libraries -lobjc -lgnustep-base \
    -fconstant-string-class=NSConstantString
  6. include path :
    C:\GNUstep\lib\gcc\mingw32\4.6.1\include
    C:\GNUstep\include