Static lib that links another static lib and qmake? Odd linking error

Posted by Dan O on Stack Overflow See other posts from Stack Overflow or by Dan O
Published on 2009-09-20T20:44:24Z Indexed on 2010/03/12 23:37 UTC
Read the original article Hit count: 344

Filed under:
|
|
|

I have two qt .pro files, both using the lib TEMPLATE and staticlib CONFIG. The first library (lets call it 'core') is a dependency for the second lib (I'll call it 'foo'). In fact, there's a class in foo that extends a class in core, I will call this class Bar.

When I instantiate the class (which is defined and implemented in foo, but extends a class (Bar) from core) in another project (not a lib) I get the following linking error:

    /usr/bin/ld: Undefined symbols:
   Bar::Bar()

Basically, the linker cannot find the class in the core lib that has been derived in the foo lib, but ONLY when I instantiate the class in a third project that is using both libs. Is this behaviour expected?

Regards, Dan O

Update: I fixed it by directly invoking the Bars constructor in the third project before using derived class... does anyone know why I need to do this?

© Stack Overflow or respective owner

Related posts about c++

Related posts about linker