Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QtCreator subdirs vs. libraries



  • I am using QtCreator 2.2.1 to create an application for Maemo and Symbian^3 phones. I refactored my code into a supporting library and the application. Now I need help making QtCreator build and link with the library. I have read the documentation and followed it as closely as I can. It does not work for me.

    I tried adding a library to the application project. In the wizard, I get as far as specifying the directory of the library's .pro file. The wizard will not let me select a library. Even if it did, it is not clear how to specify the library name and location in a platform-agnostic way.

    I tried making a subdirs project and adding my library and app directories to it:

    SUBDIRS = ../libraryprojectdir ../appprojectdir

    This let me compile but not link. There seems to be no way to specify the library build directory for each of my target platforms.



  • I would suggest to have a lib dir somewhere in your build tree and specify $DESTDIR for the lib accordingly. Then you can be sure that the lib will be in that directory, regardless of the platform. Also, I case you didn't know, you can use CONFIG += ordered to make sure your the subdirs are built in the order you specify (i.e. you lib is built first).


Log in to reply