Qt does not create output files in debug / release folders on Linux

When I create Qt applications on Ubuntu, it places the output files in the main folder of the solution, and not the release / debug folder, as in Windows.

This is problematic because sometimes the output files must be executed as part of the build process (for example, to run unit tests).

I have an idea that this has something to do with qmake.conf files, but I'm not sure what to do with it.

So my questions are:

  • Why does this difference exist (can it be just me?)
  • How should I make sure my applications are built correctly on Windows and Ubuntu?
+6
linux qt ubuntu
source share
2 answers

I assume you are using qmake to create the actual building. You can edit project files to put the output in different directories as follows:

# only for unix: unix { # in debug mode... CONFIG(debug, debug|release) { DESTDIR = debug } else { DESTDIR = release } } 

Obviously, for this you need to create both debugging and executable files. More information on this topic can be found here.

Greetings

+6
source share

The CONFIG has debug_and_release and debug_and_release_target installed on Windows but not Linux. Thus, the following line will ensure that your build is the same for linux and windows:

 CONFIG *= debug_and_release debug_and_release_target 

documentation will soon mention this. The file /usr/share/qt4/mkspecs/win32-g++/qmake.conf adds it to CONFIG .

+6
source share

All Articles