Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

objective-c compilation error

I'm using Fedora(laughlin). I've done lots of programming in c, and java on this distro. So i decided to try out some Objective-C programming in linux. I searched lots of pages over the internet and finally found one.

http://www.techotopia.com/index.php/Building_and_Installing_GNUstep_on_Linux

I went as per the instructions given on this page to install GNUstep.

Everything went well in the installation. But after writing a small piece of code and compiling it using the command:

gcc gnustep-config --objc-flags` -L/usr/GNUstep/System/Library/Libraries -lgnustep-base hello.m -o hello

It gave me the following error:

/usr/bin/ld: /usr/GNUstep/System/Library/Libraries/libgnustep-base.so: undefined reference to symbol 'objc_msg_lookup' /usr/bin/ld: note: 'objc_msg_lookup' is defined in DSO /usr/lib/libobjc.so.2 so try adding it to the linker command line /usr/lib/libobjc.so.2: could not read symbols: Invalid operation collect2: ld returned 1 exit status

I'm new to Objective-C. I have no idea where the linker command exists. I tried adding the /usr/lib to the env. variable. But it didn't work out. I also tried to find out solutions on their forum(if they had one!!). But they have none.

Can anyone please help me with this?

Thanks in advance!!

like image 244
AniketGM Avatar asked Dec 09 '22 22:12

AniketGM


1 Answers

It's complaining that you're referencing code that you aren't linking to your application. Helpfully, it's telling you what's missing and where it is. Try adding -lobjc to the flags.

like image 59
Jim Avatar answered Dec 14 '22 23:12

Jim