Important: Please read the Qt Code of Conduct -

Including a project as library

  • Hello,

    Assume I have two Qt projects, one, lets call it 'LibA' specified in the .pro file as
    TEMPLATE = lib and another gui application 'Test'. I develop on Windows 7.
    LibA is placed under C:\LibA and Test is placed under C:\Test. Furthermore i specified a common build directory C:\builds.
    In order to call functions of LibA in Test i add C:\LibA to the includepath of Test and added LIBS += C:\builds\LibA.a .
    Compiling using MinGw works fine, the application is executed and the functions of LibA are executed. Then i change the target to Android. Again compilation works fine, but when starting the application it says
    @ld returned 1 exit status, collect2.exe not found@

    What is the proper way to integrate a library in a project such that it can be used for multiple targets?

    Thank you!


  • nobody has an idea how to do that?

  • Lifetime Qt Champion


    You have to rebuild both for your various targets or use a subdir project where you build both one after the other so you won't have to handle the different target for every single project.

Log in to reply