开发者

Problem linking to a static .lib that links to a static .lib

开发者 https://www.devze.com 2023-03-04 09:21 出处:网络
I have a VS2010 solution that has two projects. The first project [DevLib] is a lib that is basically a wrapper for another lib [ExtLib] that we don\'t have the sources for. Building this lib works fi

I have a VS2010 solution that has two projects. The first project [DevLib] is a lib that is basically a wrapper for another lib [ExtLib] that we don't have the sources for. Building this lib works fine.

The second project [TestApp] then uses DevLib. When building TestApp I get:

DevLib.lib(DevCl开发者_高级运维ass.obj) : error LNK2019: unresolved external symbol _ExtLib_SomeFunction referenced in function “public: bool __thiscall DevClass::Open(void)” (?Open@DevClass@@QAE_NXZ)

So the linker finds the functions in DevLib but has problems linking to the functions in ExtLib that should now be linked with DevLib. I'm a bit lost here, is this ringing any bells for anyone?


Static libraries do not link with other static libraries. To produce a final executable, you need to link your code against all the static libraries involved. In other words if libA depends on libB, your final linkage will have to be against both libA and libB.

0

精彩评论

暂无评论...
验证码 换一张
取 消