Results 1 to 8 of 8

Thread: Disable qDebug output

  1. #1
    Join Date
    Sep 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question Disable qDebug output

    I have put into my code a lot of strings like this:

    Qt Code:
    1. qDebug ( "My value is: %s\n", Value.ascii() );
    To copy to clipboard, switch view to plain text mode 

    I'd like to view this messages only if I compile my application with debug enabled but I see it with any project configuration.
    My ".pro" file contains now:

    Qt Code:
    1. CONFIG += qt warn_off release
    To copy to clipboard, switch view to plain text mode 

    How con I get rid of qDebug messages in my compiled QT application?

    Thanks,
    the_bis

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Disable qDebug output

    Define QT_NO_DEBUG_OUTPUT during compilation and it will go away.

  3. #3
    Join Date
    Sep 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Unhappy Re: Disable qDebug output

    Quote Originally Posted by e8johan View Post
    Define QT_NO_DEBUG_OUTPUT during compilation and it will go away.
    No luck, I still see the qDebug strings in my shell.

    Now my "project.pro" file have:

    Qt Code:
    1. CONFIG += qt warn_off release
    2. DEFINES += QT_NO_DEBUG_OUTPUT
    3. DEFINES += QT_NO_DEBUG
    To copy to clipboard, switch view to plain text mode 

    I've already re-run "qmake project.pro" command but I still have the problem...

    Any othet help?

    Thanks,
    the_bis

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Disable qDebug output

    Quote Originally Posted by the_bis View Post
    Any othet help?
    We have already discussed this (see this thread) and it seems that you just can't disable qDebug() output in Qt3.

  5. #5
    Join Date
    Apr 2006
    Location
    Erlangen, Germany
    Posts
    58
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Disable qDebug output

    i'd like to reuse this thread as i have a connected problem, but in Qt 4.2.0
    my .pro starts like this:
    Qt Code:
    1. TEMPLATE = app
    2. QT += sql gui core qt3support
    3. DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT
    4. CONFIG += warn_off release qt app_bundle
    To copy to clipboard, switch view to plain text mode 

    in my main.cpp i have:
    Qt Code:
    1. #ifndef QT_NO_DEBUG_OUTPUT
    2. DebugWindow* deb = DebugWindow::self();
    3. qInstallMsgHandler(debugWinMsgHandler);
    4. #endif
    To copy to clipboard, switch view to plain text mode 

    then i deleted everything in my build-directory and tried to rebuild my app (which had been compiling fine as a debugversion) and got building errors which lead me to qglobal.h. there i found this lines:

    Qt Code:
    1. /*
    2.   Forward declarations only.
    3.  
    4.   In order to use the qDebug() stream, you must #include<QDebug>
    5. */
    6. class QDebug;
    7. class QNoDebug;
    8. #ifndef QT_NO_DEBUG_STREAM
    9. Q_CORE_EXPORT_INLINE QDebug qDebug();
    10. Q_CORE_EXPORT_INLINE QDebug qWarning();
    11. Q_CORE_EXPORT_INLINE QDebug qCritical();
    12. #else
    13. inline QNoDebug qDebug();
    14. #endif
    To copy to clipboard, switch view to plain text mode 

    i did change my DEFINES to
    Qt Code:
    1. DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT QT_NO_DEBUG_STREAM
    To copy to clipboard, switch view to plain text mode 

    but still i get
    Qt Code:
    1. C:/Qt/4.2.0/include/QtCore/../../src/corelib/global/qglobal.h:1246: error: expected unqualified-id before "if"
    2. C:/Qt/4.2.0/include/QtCore/../../src/corelib/global/qglobal.h:1246: error: expected `,' or `;' before "if"
    3. C:/Qt/4.2.0/include/QtCore/../../src/corelib/global/qglobal.h:1246: error: expected unqualified-id before "else"
    4. C:/Qt/4.2.0/include/QtCore/../../src/corelib/global/qglobal.h:1246: error: expected `,' or `;' before "else"
    To copy to clipboard, switch view to plain text mode 

    line 1246 is the
    Qt Code:
    1. inline QNoDebug qDebug();
    To copy to clipboard, switch view to plain text mode 
    in the quote above. So what is the problem? the way i understand it they forward-declare classes QDebug and QNoDebug, and as i defined QT_NO_DEBUG_STREAM QNoDebug should be used whereve i call qDebug. Sounds fine to me

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Disable qDebug output

    What errors did you get in the first place?

  7. #7
    Join Date
    Apr 2006
    Location
    Erlangen, Germany
    Posts
    58
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Disable qDebug output

    ahem. now that you ask ... i tried again: i get the same errors. so the QT_NO_DEBUG_STREAM seems to make no difference - it seems to be set automatically if the QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT are set.
    Nevertheless i cannot compile
    Last edited by mikro; 30th November 2006 at 18:38.

  8. #8
    Join Date
    Apr 2006
    Location
    Erlangen, Germany
    Posts
    58
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Disable qDebug output

    well seems that this time it is not my fault:
    http://www.trolltech.com/developer/t...ntry&id=133726

Similar Threads

  1. qdebug
    By drkbkr in forum Qt Programming
    Replies: 12
    Last Post: 29th September 2006, 15:26
  2. qmake and debug output
    By mattie in forum Qt Programming
    Replies: 7
    Last Post: 18th September 2006, 22:33
  3. How can I disable the QListView Sorting?
    By darpan in forum Qt Programming
    Replies: 3
    Last Post: 27th June 2006, 10:36
  4. QProcess output in TreeView?!?
    By nupul in forum Qt Programming
    Replies: 1
    Last Post: 2nd May 2006, 08:05
  5. Disable Tab Key
    By otortos in forum Newbie
    Replies: 6
    Last Post: 25th March 2006, 16:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.