Lee, Andrew Hickinbottom (3D)

View Full Version : Newbie problem with -lobjc

11-14-2006, 03:46 AM
Sorry if this is a stupid question but i'm having problems compiling a project in dev-c++ because it always throws the same error:
"cannot find -lobjc
ld returned 1 exit status "

Thank you for any information.

11-14-2006, 07:08 PM
It's looking for the libobjc shared library and it can't find it, so you either need to add that the standard location for libraries on your system, or if you're not compiling an Objective C program, instruct the linker not to look for that library.

11-14-2006, 08:58 PM
I still can't make it work because I can't find that library, does anyone knows where can I get that library

11-14-2006, 09:41 PM
Maybe one of these will help?


11-15-2006, 01:23 AM
I've already tried many forums but nothing....:sad:

11-15-2006, 09:53 PM
Do you have a libobjc.* any where on your system?

11-16-2006, 03:18 PM
No, I can't find it anywhere.

11-17-2006, 11:47 PM
Are you trying to do objective c programming?

If so, then you need to find a copy that matches your environment and put it in a path where your linker can find it.

If not, you need to find the spot in your project's files that is trying to link it in and remove the reference to it.

11-18-2006, 12:13 PM
Have you tried looking for files such as libobjc.o, libobjc.a or basically anything starting with libobjc? That's what it'll actually be looking for. If you can't find such files, it is likely you're trying to do Objective C without having the development libraries. Have a look at this page (http://molhanec.net/devcpphelp/packages.php) on Development Packages, you'll be wanting gcc-objc as can be seen in the second image.

11-18-2006, 07:41 PM
Thank you Bill and Paul, I downloaded the gcc-objc devpak and it worked!

11-18-2006, 07:51 PM
:sad: I have another problem now, when I change anything in the code and I fix it back and try to compile it, there's an error:

[Linker error] undefined reference to `__gxx_personality_v0'
[Linker error] undefined reference to `__gxx_personality_v0'
ld returned 1 exit status
Error 1

11-19-2006, 12:49 AM
This is referenced as an error that occurs either when using gcc when you should be using g++. What might be happening is that while gcc can compile objc code, it does need to be told by the file extension; if you feed gcc a file with the .c suffix it will try to compile it as plain C code. The suffix for objective c is .m e.g. instead of myprogram.c you would use myprogram.m. This should hopefully tell gcc that it's dealing with Objective C and trigger the appropriate actions.

Further information on Objective C options for gcc can be found here (http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Objective_002dC-and-Objective_002dC_002b_002b-Dialect-Options.html#Objective_002dC-and-Objective_002dC_002b_002b-Dialect-Options), although there may be minor differences depending on exactly which version of the GCC you're using.

I hope this sorts the problem out, I may be barking up completely the wrong tree having not done Objective C in my life but it's a possible answer :D

CGTalk Moderation
11-19-2006, 12:49 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.