Posted on February 11th, 2014
[Ubuntu setup]
- apt-get install gobjc build-essential
- 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];
} - 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) - From: http://www.gc3.uzh.ch/blog/Compile_a_Objective-C_application_on_Ubuntu___40__Hobbes_instance__41__/
[MAC Setup]
- gcc -o hello hello.m -framework Foundation
[Window Setup]
- Download the packages from http://www.gnustep.org/experience/Windows.html
- Install the packages step by step : GNUstep MSYS System, GNUstep Core, GNUstep Devel, GNUstep Cairo,ProjectCenter,Gorm.
- Enter the GNUstep shell : C:\GNUstep\msys\1.0\msys.bat
- The root folder is C:\GNUstep\msys\1.0
- Compile : gcc -o hello hello.m -I /GNUstep/System/Library/Headers \
-L /GNUstep/System/Library/Libraries -lobjc -lgnustep-base \
-fconstant-string-class=NSConstantString
- include path :
C:\GNUstep\lib\gcc\mingw32\4.6.1\include
C:\GNUstep\include