Compile a shared library statically

Posted by Simon Walker on Stack Overflow See other posts from Stack Overflow or by Simon Walker
Published on 2010-05-11T15:39:55Z Indexed on 2010/05/11 15:44 UTC
Read the original article Hit count: 270

Filed under:
|
|
|
|

I've got a shared library with some homemade functions, which I compile into my other programs, but I have to link the end program with all the libraries I have used to compile the static library. Here is an example:

I have function foo in the library which requires a function from another library libbar.so.

In my main program to use function foo I have to compile it with the -lbar flag. Is there a way I can compile my library statically so it includes all the required code from the other libraries, and I can compile my end program without needing the -lbar flag?

Cheers

© Stack Overflow or respective owner

Related posts about c

    Related posts about c++