Sunday 16 August 2009

HOWTO: compile objective-c using gcc in Linux

to compile these examples of objective-c (install libobjc first) from objective-c on wikipedia.org

1) traditional:
gcc -c XX.m XXX.m -Wno-import
gcc -o prog XX.o XXX.o -lobjc -Wno-import

2) gcc *.m -lojbc -Wno-import

Note:
-Wno-import is because the maintainer of gcc doesn't like 'import';

-lobjc: -l(library) -L(libaray directory) -lobjc(for GNU objective-c libraray)


For those examples using GNUstep, most of the header files need to be changed from ' #import ' to '#import ' to suit the GNU objective-c library.

More details: http://www.cs.indiana.edu/classes/c304/oop-intro.html

No comments:

My photo
London, United Kingdom
twitter.com/zhengxin

Facebook & Twitter