Archived Forum Post

Index of archived forum posts

Question:

How to link with -lresolv in XCode?

Oct 06 '12 at 09:42

Sorry to ask, but I have a linking problem on Xcode 4.4 and the latest cocoa chilkat mail libraries.

I have a simple unlockcomponent and I get

Undefined symbols for architecture x86_64:
  "_res_9_query", referenced from:
      ChilkatResolve::mxLookup(char const, ScoredStrings&, LogBase&, bool) in libchilkatCocoa.a(ChilkatResolve.o)
      ChilkatResolve::dkimLookup(char const, StringBuffer&, LogBase&, bool) in libchilkatCocoa.a(ChilkatResolve.o)
      ChilkatResolve::bestMxLookup(char const*, StringBuffer&, LogBase&, bool) in libchilkatCocoa.a(ChilkatResolve.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I should perhaps link the -lresolv, -lpthread libraries but I don't know how to do this.


Answer

One possible way of doing it is to right-click on the project and select "Add Files to XYZ", where XYZ is the name of your project.

Then navigate to the root of your hard drive, such as "Server HD", then navigate down such as:

Server HD-->Developer-->Platforms-->iPhoneOS.platform-->Developer-->SDKs-->iPhoneOS5.0.sdk-->usr-->lib and then select "libresolv.9.dylib"

Then try linking again.