ryu's blog just a few lines of code

13Oct/110

HOWTO Compile Objective-C in Ubuntu (11.04)

To compile Objective-C code in Ubutnu, just install gcc, gobjc, gnustep and clang.
The actual compile process for a file eg. called code.m starts with the following line:

# gcc -o code code.m -I /usr/include/GNUstep/ -L /usr/lib/GNUstep/ -lgnustep-base -fconstant-string-class=NSConstantString

But, in my case there was an error: 'error: #error The current setting for native-objc-exceptions does not match that of gnustep-base ... please correct this.'
To solve this problem, do the following:

# vim /usr/include/GNUstep/GNUstepBase/GSConfig.h

:set nu

Go to line number (in my case) 221, or search for:

#define BASE_NATIVE_OBJC_EXCEPTIONS 1

Replace the line with:

#define BASE_NATIVE_OBJC_EXCEPTIONS 0

Now the compiler should work without problems! :)

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.