Results 1 to 6 of 6

Thread: Unable to use qDebug() to debug

  1. #1
    Join Date
    Aug 2011
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post Unable to use qDebug() to debug

    The application I am working on has a ton of runtime errors/bugs. To remove the errors, and make sure everything is working I added a qDebug() in every significant function.

    For example, to follow my signal-slot connections and see if they're working properly.

    But I'm not getting any command line output when I run my application. Even for things which I know have happened. For instance, I put qDebug() in the MainWindow's constructor and got no output.

    Something like
    Qt Code:
    1. MainWindow::MainWindow()
    2. {
    3. ...
    4. qDebug()<<"MainWindow constructed.";
    5. ...
    6. }
    To copy to clipboard, switch view to plain text mode 

    I have included QDebug, and I've re-checked that I'm using the correct syntax. I'm not sure what I'm doing wrong.

    Help is greatly appreciated.
    Last edited by Rikonator; 17th August 2011 at 11:40.

  2. #2
    Join Date
    Dec 2008
    Location
    France
    Posts
    93
    Thanked 23 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: Unable to use qDebug() to debug

    Check if QT_NO_DEBUG_OUTPUT is defined at compilation time (look to your compile command) or check if there is any use of
    Qt Code:
    1. QtMsgHandler qInstallMsgHandler ( QtMsgHandler handler )
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Unable to use qDebug() to debug

    What platform ? What version are you running, release or debug ?
    If its on windows, release version does not have a console output available, you can add CONFIG += console, or run the app under gdb. Debug version should print the messages normally.

  4. #4
    Join Date
    Aug 2011
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Unable to use qDebug() to debug

    I'm running Windows. And running debug, not release. I even added CONFIG += console, but then it would not compile.

    It gave me this error:
    undefined reference to WinMain@16
    Also, I checked the compile command, and did not see QT_NO_DEBUG_OUTPUT.

  5. #5
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Unable to use qDebug() to debug

    Have you tried to run your app from cmd line, or gdb ?

  6. The following user says thank you to stampede for this useful post:

    Rikonator (17th August 2011)

  7. #6
    Join Date
    Aug 2011
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Unable to use qDebug() to debug

    It worked with gdb. Thank you so much!

    Now on to exterminate 'em bugs.

Similar Threads

  1. Replies: 13
    Last Post: 6th May 2011, 10:34
  2. QTCreator Mac - Unable to debug properly?
    By regrant in forum Qt Programming
    Replies: 3
    Last Post: 28th October 2010, 22:29
  3. Unable to run debug exe of Qt application in visual studio 2008
    By merry in forum Installation and Deployment
    Replies: 9
    Last Post: 8th October 2010, 09:24
  4. Unable to debug simple Qt application on any of the target?
    By linux.devil in forum Installation and Deployment
    Replies: 1
    Last Post: 3rd October 2010, 05:29
  5. Unable to execute in Debug Mode
    By Kapil in forum Installation and Deployment
    Replies: 38
    Last Post: 5th April 2006, 07: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.