XCode Compiler Error: ld: library not found for -loauth
Asked Answered
J

3

12

I'm trying to use the Twitter libraries and after adding liboauth.a and adding oauthconsumeriphonelib to my header search path, I'm now down to 1 compilation error, which I can't seem to get rid of.

ld: library not found for -loauth
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

Anyone know what could be causing this?

Jacquijacquie answered 4/2, 2011 at 8:29 Comment(0)
R
17

Continuing to What Robin suggested You also need to set the Library Search Path. Right Click the Target File and Choose -- Get Info else you can also get the same by choosing Edit Actice Target Under the Project Tab in XCode. Look for Library Search Path and add this "$(SRCROOT)/Twitter+OAuth/SAOAuthTwitterEngine" Where Twitter+OAuth/SAOAuthTwitterEngine is the directory path for Twitter Library in project folder. I hope this will fix the problem.


enter image description here

Roughrider answered 4/2, 2011 at 10:4 Comment(5)
Thanks Rahul. I did what you suggested and now I'm seeing other errors that I thought I was over with. ld: warning: in /usr/local/lib/liboauth.dylib, file was built for i386 which is not the architecture being linked (armv6) I had to reinstall liboauth with ./configure CC="gcc -arch i386" CXX="g++ -arch i386" and those errors had gone away. THis is just a warning but it's complaining about a bunch of missing files... objc-class-ref-to-OAToken in SA_OAuthTwitterEngine.oJacquijacquie
Actually I see that warning only when I build for the device. When I build to the simulator I see the same warnings about references to missing OAuth classes but I don't see the warning.Jacquijacquie
You will have to add those For All settings separately Viz All configuration In The Target Build Properties. Also make sure that the library is physically present at the mentioned location in the project fileRoughrider
I have done that already. I have recursively added the entire Twitter Folder to both the header search path and the library search path. Nothing seems to make that error go away.Jacquijacquie
Well, it was a search path issue and I was able to get this working by adding both my $SRCROOT folder and the Twitter folder in the search paths. I'll split the credit between you and robin for keeping me in the right direction.Jacquijacquie
H
2

Well @Nefsu you need to add those libraries to your project by adding an existing framework and then giving the path of the libraries you want to use.

And if you have already added the libraries by drag and drop, than dont remove them just add existing framework by right clicking on groups and folders and add the libraries from the folder and you will be done

Hendricks answered 4/2, 2011 at 8:51 Comment(4)
Thanks for the suggestion Robin, but I'm not sure what you mean by "giving the path to the libraries you want to use." I added liboauth.a from /usr/local/lib by right clicking no frameworks and selecting it as an existing external framework. Is there something else I'm supposed to do? I should point out that before I added that lib I was getting five compilation errors about classes that couldn't be found.Jacquijacquie
can you give the exact error that you are getting during buildHendricks
you can check this link too #4836254Hendricks
hey robin, the compiler error I see is ld: library not found for -loauth.Jacquijacquie
I
1

I discovered this HIGHLY misleading message while trying to upgrade to the new Google Analytics library.

In my case the problem was having TWO CONFLICTING COPIES of the library. They were in different folders but both were listed in my App's Library Build Paths (under Build Settings).

Moving all the deprecated library files out of the folder ended up doing the trick and made the mysterious error messages go away.

Ingurgitate answered 3/8, 2014 at 16:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.