views:

454

answers:

1

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?

+1  A: 

The problem is the order. It's relevant for static libraries.

Change the order of the libraries in the LIBS line.

Thiago Macieira