August 2, 2011

David Talmage David Talmage
Lab Rat
51 posts

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.

1 reply

August 3, 2011

loladiro loladiro
Lab Rat
594 posts

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).

  ‹‹ [SOLVED] linking errors in Qt      Setup Wizard Solution ››

You must log in to post a reply. Not a member yet? Register here!