How to Link Another Static Library to my Static Library in XCode?

Possible to link my static library with a dynamic library in Xcode?

  • I am currently creating a static library that contains functionality I want to provide to some other applications. However, my static library requires libxml2.dylib and compiling my static library fails at the moment because it's having trouble accessing the dylib. Is there a way to link my static lib with a dynamic lib?

  • Answer:

    Yes, this is possible. However, the resulting static library will have a run-time dependency to libxml2. Notice that you will have to specify the location of the dynamic library at linktime using the -L switch. Assuming you have installed libxml2 using http://www.macports.org/ the path is /opt/local/lib. g++ -staticlib -o libyourlib.a file1.o file2.o -L/opt/local/lib -lxml2

jkt610 at Stack Overflow Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.