Results 1 to 13 of 13

Thread: qdebug

  1. #1
    Join Date
    Jan 2006
    Posts
    39
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default qdebug

    Hello,

    Is there some way to turn off qDebug with a compile or run time flag? When I build for release, I don't necessarily want the full debug output I want when developing, but I don't want to take all the output out of the code, either.

    Any help would be appreciated.

    Thanks,
    Derek

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

    Default Re: qdebug

    CONFIG-=debug could probably help.

  3. #3
    Join Date
    Jan 2006
    Posts
    39
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: qdebug

    I thought so too. Probably should have included this before, but my .pro file contains

    CONFIG+=qt release incremental link_prl
    CONFIG-=debug

    Do I have syntax wrong or something?

    Thanks.

  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: qdebug

    How about "DEFINES += QT_NO_DEBUG_OUTPUT"?

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

    Default Re: qdebug

    No, my mistake. I had to check the docs Add something like this to your project file:
    DEFINES += QT_NO_DEBUG_OUTPUT

    And again... Jacek was faster

  6. #6
    Join Date
    Jan 2006
    Posts
    39
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: qdebug

    Thank you both. But I'm still missing something.

    My project file now looks like this, and qDebug still produces output.

    Qt Code:
    1. ######################################################################
    2. # Automatically generated by qmake (1.07a) Thu Sep 28 17:09:30 2006
    3. ######################################################################
    4.  
    5. OBJECTS_DIR=.obj/
    6. MOC_DIR=.moc/
    7. DEFINES += QT_NO_DEBUG_OUTPUT
    8. CONFIG = qt release incremental link_prl
    9. TEMPLATE = app
    10. DEPENDPATH += include src
    11. INCLUDEPATH += . include
    12.  
    13. # Input
    14. HEADERS += include/Chooser.h \
    15. include/Configurator.h \
    16. include/Creator.h \
    17. include/Exerciser.h \
    18. include/ExerciserException.h \
    19. include/FileChooser.h \
    20. include/logo.h \
    21. include/ResultsFile.h \
    22. include/Sender.h \
    23. include/SequenceArguments.h \
    24. include/SequenceSpecifier.h \
    25. include/versioninfo.h
    26. SOURCES += src/Chooser.cpp \
    27. src/Configurator.cpp \
    28. src/Creator.cpp \
    29. src/Exerciser.cpp \
    30. src/ExerciserException.cpp \
    31. src/FileChooser.cpp \
    32. src/ResultsFile.cpp \
    33. src/Sender.cpp \
    34. src/SequenceArguments.cpp \
    35. src/SequenceSpecifier.cpp
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: qdebug

    Did you remember to rerun qmake (and rebuild all files from the project) afterwards?

  8. #8
    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: qdebug

    Maybe you have to define QT_NO_WARNING_OUTPUT too?

  9. #9
    Join Date
    Jan 2006
    Posts
    39
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: qdebug

    I did both of the above things (although I'd probably like to keep warnings on) and I still get it. The compile command being run is like this:

    g++ -c -pipe -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fomit-frame-pointer -march=i586 -mtune=pentiumpro -DQT_NO_DEBUG_OUTPUT -DQT_NO_WARNING_OUTPUT -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -I/usr/lib/qt3/mkspecs/default -I. -I. -Iinclude -I/usr/lib/qt3//include -I.moc/ -o .obj/Exerciser.o src/Exerciser.cpp
    Derek
    Last edited by jacek; 29th September 2006 at 13:53. Reason: changed [ code ] to [ quote ] to allow wrapping

  10. #10
    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: qdebug

    Since you use Qt3, not Qt4, try "DEFINES += QT_NO_DEBUG".

  11. #11
    Join Date
    Jan 2006
    Posts
    39
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: qdebug

    Still no luck.

    The result of that is that it adds another -DQT_NO_DEBUG to the compile command (there was one there already as well), but I'm still getting output.

    Derek

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

    Default Re: qdebug

    qDebug seems to be a function in Qt3, so it might be impossible to do that through Qt directly. But you can provide your own macro, which would expand to nothing if a certain macro is defined or to qDebug() if it is not (or vice versa) and use that macro instead of qDebug().

  13. #13
    Join Date
    Jan 2006
    Posts
    39
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: qdebug

    I thought it was possible to turn on and off the debug output easily with a compile time flag but I guess not.

    The QT 3 docs say that the QT_DEBUG flag "Enables debugging code" and that the QT_NO_DEBUG flag turns off the QT_DEBUG flag. So I guess I don't know what exactly that means.

    Anyway, I've created a macro that expands to qDebug, and it works fine.

    Thanks to you both,

    Derek

Similar Threads

  1. changing layout of a widget
    By mikro in forum Qt Programming
    Replies: 10
    Last Post: 4th August 2009, 20:21
  2. removeAll not working
    By cristianbdg in forum Qt Programming
    Replies: 4
    Last Post: 11th September 2007, 14:23
  3. setCanvas blocks mouse movement on QtCanvasView
    By YuriyRusinov in forum Qt Programming
    Replies: 8
    Last Post: 20th April 2006, 07:38
  4. Problem with internationalisation
    By piotrpsz in forum Qt Programming
    Replies: 7
    Last Post: 5th February 2006, 16:53

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.