QDebug lines



  • Hi ALL,

    I'm wondering what happen to the qDebug() lines I've written on my code when I build the app for release. Does this code make the app more heavy and slow?



  • Hi,

    Your qDebug() lines will be ouputed unless you define QT_NO_DEBUG_OUTPUT during compilation (even if you are in release mode). If you didn't specify a message handler, stderr will be used, and yes it will make the app slower if you're writing too much. So, just define QT_NO_DEBUG_OUTPUT where you are in release mode.



  • I have added what you have suggested to add to my project file but it seems it doesn't work. I launched the app on Qt using the run button and I have looked at the output window on Qt and the qDebug() lines still apear so, how can I check if the added line stops the qDebug() lines, properly?

    Here the code I have added to the project file:
    @
    CONFIG -= debug
    CONFIG += release

    release {
    message(Release build!)
    DEFINES += QT_NO_DEBUG_OUTPUT
    }

    debug {
    message(Debug build!)
    DEFINES += DEBUG
    }
    @



  • I tried the following to detect debug and release config:

    @
    CONFIG(debug, debug|release) {
    DEFINES += DEBUG
    }
    else {
    DEFINES += QT_NO_DEBUG_OUTPUT
    }
    @

    It works for me to disable qDebug() output.



  • I did it. As before, looking at the output window on qt, after I had launched the executable using the run button, I still can see the qDebug lines are working....



  • [quote author="tilsitt" date="1355915223"]I tried the following to detect debug and release config:

    @
    CONFIG(debug, debug|release) {
    DEFINES += DEBUG
    }
    else {
    DEFINES += QT_NO_DEBUG_OUTPUT
    }
    @

    It works for me to disable qDebug() output.[/quote]

    I'm sorry but I'd like to know: where did you add the above lines?
    I added my lines on my qt .pro file and it seems they don't work!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.