Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDebug lines
Qt 6.11 is out! See what's new in the release blog

QDebug lines

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 4.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gRicky
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tilsitt
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gRicky
        wrote on last edited by
        #3

        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
        }
        @

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tilsitt
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gRicky
            wrote on last edited by
            #5

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

            1 Reply Last reply
            0
            • G Offline
              G Offline
              gRicky
              wrote on last edited by
              #6

              [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!

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved