1

I'm making a library which I want to link dynamically into projects. This library makes use of pthread, opengl, xlib, xrandr, freetype, glew, jpeg, sndfile, and openal. Currently when I compile the library and try to link it in a program I have to link each of those dependencies individually as well, I want to have all those linked into the library by default. Is this possible?

4
  • Is your library build as dynamic library? (dll for windows, so for unix systems) Commented Oct 3, 2013 at 18:53
  • I was building it as static, is it not possible to do this with static libraries? At any rate, I changed it to dynamic in my project settings but now it doesn't build at all. The compiler runs and doesn't get any errors but there's no .so in the bin directory. I'll try to link the .o's together manually, it'll just take a minute. Commented Oct 3, 2013 at 19:00
  • Is it possible to link two .so's together? Commented Oct 3, 2013 at 19:09
  • you mean merge them into one so file? Commented Oct 3, 2013 at 19:34

1 Answer 1

1

you have to get the .a format binary for those libraries you would like to link statically, and include them when you build your target library. that will do the trick. Normally, third party libraries will also have a .a format along with .so

Please take a look here as well. http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html

Sign up to request clarification or add additional context in comments.

2 Comments

So all I have to do is link libGLEW.a etc. into the build? Great, thanks!
Yes. and please take a look in the link posted above.