Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [SOLVED]qDebug and debug release
QtWS25 Last Chance

[SOLVED]qDebug and debug release

Scheduled Pinned Locked Moved Qt Creator and other tools
7 Posts 3 Posters 21.9k Views
  • 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.
  • F Offline
    F Offline
    fluca1978
    wrote on last edited by
    #1

    Hi,
    this can be a trivial question, but I've got a doubt about qDebug: reading the documentation it seems to me this is much more a logging facility than a debug facility, and if I get it right, it will continue to output messages even for a release compiled version of the application. Am I right? If so, how is the verbose level configured?

    1 Reply Last reply
    1
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      The only verbosity level you have is the distinction between qDebug, qWarning and qCritical (and qFatal the special case that terminates the application).

      The first two methods do nothing if during compile time the macros QT_NO_DEBUG_OUTPUT or rather QT_NO_WARNING_OUTPUT are defined. One cannot suppress critical messages, though.

      You can set the macro in your .pro file and if you put into a scope you can make that automagic:

      @
      CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
      @

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fluca1978
        wrote on last edited by
        #3

        Thanks, it is clear now.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          Oh, just as a side not, I forgot to mention: You will need to recompile the complete project with the new DEFINE settings, otherwise the change will not be caught up by every source file and you may end up with partially disabled debug output only.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          1
          • F Offline
            F Offline
            fluca1978
            wrote on last edited by
            #5

            Interesting.
            Isn't qtcreator smart enough to do a clean/rebuild all when the .pro file changes?

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

              No. Qt Creator does nothing in that respect. All it does, is call "make". With usual makefiles, something is only recompiled, if one of the dependencies of the file has changed (usually the header and source file and the includes of those, in Qt world additionally the .ui file).

              I know of Visual Studio, that if you change a DEFINE the whole project is rebuilt. But as stated, that's not true for makefile based projects, as in Creator.

              Oh, and even if you use the VS toolchain together with Creator on windows, the build is based on makefiles! Creator calls nmake or jom in that case.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • Q Offline
                Q Offline
                qttester5
                wrote on last edited by
                #7

                [quote author="Volker" date="1317931380"]The only verbosity level you have is the distinction between qDebug, qWarning and qCritical (and qFatal the special case that terminates the application).

                The first two methods do nothing if during compile time the macros QT_NO_DEBUG_OUTPUT or rather QT_NO_WARNING_OUTPUT are defined. One cannot suppress critical messages, though.

                You can set the macro in your .pro file and if you put into a scope you can make that automagic:

                @
                CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
                @
                [/quote]

                I am finding that qDebug() only operates when you run in debug mode, and it does not matter if you have the above CONFIG statement in your .pro or not.

                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