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. Why does this defined QT_NO_DEBUG_OUTPUT not supress the qDebug?
Forum Updated to NodeBB v4.3 + New Features

Why does this defined QT_NO_DEBUG_OUTPUT not supress the qDebug?

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 3 Posters 10.7k Views 3 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.
  • D Offline
    D Offline
    DragonautX
    wrote on last edited by DragonautX
    #3

    Oh, I was doing a Debug build. I switched to release build, cleaned, ran qmake, did a build, and did Ctrl+R to run, but the qDebug message is still showing in QtCreator's Application Output. Do you know anything else I can try?

    mrjjM 1 Reply Last reply
    0
    • D DragonautX

      Oh, I was doing a Debug build. I switched to release build, cleaned, ran qmake, did a build, and did Ctrl+R to run, but the qDebug message is still showing in QtCreator's Application Output. Do you know anything else I can try?

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @DragonautX
      Ok that's odd.
      I use
      CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT

      Let me check if it still works :)

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DragonautX
        wrote on last edited by DragonautX
        #5

        Oh wait, it's my .pro file that's the problem. I added the line you said you used, cleaned, qmake, built, and ran, and it worked. I didn't know you were supposed to add that line to your .pro. I thought a #define would work just fine by itself?

        QT += widgets
        
        SOURCES += \
            main.cpp
        
        CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
        
        mrjjM 2 Replies Last reply
        0
        • D DragonautX

          Oh wait, it's my .pro file that's the problem. I added the line you said you used, cleaned, qmake, built, and ran, and it worked. I didn't know you were supposed to add that line to your .pro. I thought a #define would work just fine by itself?

          QT += widgets
          
          SOURCES += \
              main.cpp
          
          CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
          
          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #6

          @DragonautX
          seems fine. make sure to really clean build folder.

          1 Reply Last reply
          1
          • D DragonautX

            Oh wait, it's my .pro file that's the problem. I added the line you said you used, cleaned, qmake, built, and ran, and it worked. I didn't know you were supposed to add that line to your .pro. I thought a #define would work just fine by itself?

            QT += widgets
            
            SOURCES += \
                main.cpp
            
            CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
            
            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by mrjj
            #7

            @DragonautX
            Just tested in this sample
            https://www.dropbox.com/s/oaf75jo0awpm1fc/mydebug.zip?dl=0
            Works here in Qt5.7 win 10.

            1 Reply Last reply
            1
            • D Offline
              D Offline
              DragonautX
              wrote on last edited by
              #8

              Ya, it worked. I guess I was clicking too fast and forgot to really clean. It works for both the #define preprocessor and the .pro code. Anyways, thanks for the help and uploading an example too. That was helpful. I'll make sure to check next time if I'm Debug or Release mode.

              mrjjM 1 Reply Last reply
              1
              • D DragonautX

                Ya, it worked. I guess I was clicking too fast and forgot to really clean. It works for both the #define preprocessor and the .pro code. Anyways, thanks for the help and uploading an example too. That was helpful. I'll make sure to check next time if I'm Debug or Release mode.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #9

                @DragonautX
                Super
                As last note:
                I find this pretty nice

                qDebug()<<__FILE__<<__LINE__<<__PRETTY_FUNCTION__;
                
                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DragonautX
                  wrote on last edited by
                  #10

                  That's pretty cool. Didn't know predefined macros like that were there before. wasn't able to use __PRETTY_FUNCTION__, but __FUNCTION__ worked. From SO, seems like __PRETTY_FUNCTION__ is only for some gcc compiler, and Qt says I'm using mvsc. Is it supposed to work with mvsc too? That's how all my test projects have been compiled on so far by Qt.

                  mrjjM 1 Reply Last reply
                  0
                  • D DragonautX

                    That's pretty cool. Didn't know predefined macros like that were there before. wasn't able to use __PRETTY_FUNCTION__, but __FUNCTION__ worked. From SO, seems like __PRETTY_FUNCTION__ is only for some gcc compiler, and Qt says I'm using mvsc. Is it supposed to work with mvsc too? That's how all my test projects have been compiled on so far by Qt.

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by mrjj
                    #11

                    @DragonautX said in Why does this defined QT_NO_DEBUG_OUTPUT not supress the qDebug?:

                    PRETTY_FUNCTION

                    oh yes, sorry, its gcc
                    I think Vs have

                    __FUNCDNAME__; // Decorated
                    __FUNCSIG__; // Signature
                    and 
                    __FUNCTION__; //should be same
                    
                    

                    Didnt test lately, but it does have something the same.

                    1 Reply Last reply
                    1
                    • D Offline
                      D Offline
                      DragonautX
                      wrote on last edited by
                      #12

                      Alright, cool. Thanks for the tip!

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #13

                        Hi,

                        Otherwise you can use Q_FUNC_INFO. Shorter to write :)

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        2

                        • Login

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