Linking static libraries with c++/cmake

谁都会走 提交于 2019-12-02 08:03:04

I think you are misunderstanding the creation of a static library. A static library is a collection of object files, it does not have any init/deinit code to pull in additional libraries like a shared library or an executable can.

If you create a libraryA that uses code from libraryB and libraryC when you build applicationX that uses libraryA you must manually pull in both libraryB and libraryC. With shared libraries this is not necessary.

If you investigate pkg-config you can see the property Libs.private that specifies these additional private or internal libraries that a static link would require.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!