Important: Please read the Qt Code of Conduct -

[SOLVED] How to decide whether to build in debug or release mode?

  • This question is so basic that I could not find any information on it...all I found was related to advanced subjects.

    When I run qmake <myproject>, and the make (or mingw32-make), will I build the project in debug or release mode?

    How can I tell either qmake or make what I want?

  • add to your *.pro file line:
    @CONFIG += debug_and_release@

    now do qmake
    it will generate Makefile Makefile.Debug Makefile.Release

    make release
    or make debug now ;-)

  • And I was looking for a command line argument all the time.


  • you could use:

    qmake CONFIG+=debug XXX

  • Building both debug and release works well for MinGW/Windows, but the same doesn't work on GCC/Linux.

    With the same .pro file, only one Makefile is created (the debug version).

    How do I build both debug and release versions using GCC on Linux?

  • Stranger still, even if I explicitly specify only
    @CONFIG += release@
    in the project file, the debug version is built.

    Or at least, I always enter the
    @debug {
    bracket in my .pro and .pri files.

  • [quote author="Asperamanca" date="1323881434"]Or at least, I always enter the
    @debug {
    bracket in my .pro and .pri files.[/quote]

    So, this is a different problem :-)
    you should use:

    CONFIG(debug, debug|release) {
    mac: TARGET = $$join(TARGET,,,_debug)
    win32: TARGET = $$join(TARGET,,,d)

  • I find that if you use Qt Creator, it is a bad idea to specify the type of build explicitly in the pro file. Just use Creators facilities for that. In the project page, you can specify the build mode you need. While developing, that will most often be Debug, when getting closer to finishing and when working on optimizations, you will want to start building in release mode.

  • Creator is just one of several platforms. It's an IDE, and does not offer a replacement for a true build process.

    And BTW, the mistake was a stupid one: I put the line
    @CONFIG += debug@
    at a central position into a central .pri file, and forgot about it.

    What set me on the wrong track that I could still build release versions under Windows.

Log in to reply