PDA

View Full Version : Newbie problem with -lobjc


Odin2014
11-14-2006, 02: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.

billrobertson42
11-14-2006, 06: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.

Odin2014
11-14-2006, 07: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

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

http://www.google.com/search?hl=en&lr=&q=dev-c%2B%2B+cannot+find+lobjc&btnG=Search

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

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

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

billrobertson42
11-17-2006, 10: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.

UrbanFuturistic
11-18-2006, 11:13 AM
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.

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

Odin2014
11-18-2006, 06: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

UrbanFuturistic
11-18-2006, 11:49 PM
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-18-2006, 11:49 PM
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.