Important: Please read the Qt Code of Conduct -

How to set compiler directives per build configuration

  • I have the following in my .pro file to send the -DDEBUG directive when I am using the debug configuration:
    @CONFIG (debug)

    When I compile I get the following output, which I would expect

    g++ -c -pipe -g -fPIC -Wall -W -D_REENTRANT -DDEBUG ...

    The problem is that when I want to build a release version of my program, the -DDEBUG is still showing up when I compile even though it appears that the rest of the output is as I would expect


    I'm using the DEBUG directive provide debugging output to the screen as well as intermediate files which will not be available for my release version.

    Any help would be greatly appreciated.

  • I don something like this,


    CONFIG(debug, debug|release) {
    } else {
    CONFIG_SUFFIX = Release


  • That did it.


Log in to reply