[Interest] qmake, executable & static libs...

Thiago Macieira thiago.macieira at intel.com
Thu Jun 18 08:48:21 CEST 2015


On Thursday 18 June 2015 09:24:38 Igor Mironchik wrote:
> Hi guys,
> 
> I'm porting Qt 5 application to Linux and ran into a problem of linking.
> 
> This application depends on two external static libs (let's say libs A
> and B). But this libs is in the tree of the project.
> 
> And this project depends on two yet internal static libs (let's say libs
> C and D). Libs C and D depends on libs A and B.
> 
> All static libs creates successfully.
> 
> But executable can't link. I have added all 4 static libs ( A,B,C,D ) to
> the project of executable ( link rules, pretarget deps...)
> 
> And ld says when linking executable that in static lib C there are
> undefined references to functions and methods from static lib A.
> 
> What should I do in .pro files to solve this problem.

You need to list the libraries in the right order. The order of static 
libraries is relevant, unlike for dynamic libraries.

You must first list the library that requires a symbol, then the library that 
provides the symbol, so that the undefined reference can be resolved.

Or the other way around...
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list