imightbewrong
imightbewrong

Reputation: 388

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

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(DevClass.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?

Upvotes: 0

Views: 152

Answers (1)

user2100815
user2100815

Reputation:

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.

Upvotes: 2

Related Questions