PDA

View Full Version : Unable to use qDebug() to debug



Rikonator
17th August 2011, 11:26
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


MainWindow::MainWindow()
{
...
qDebug()<<"MainWindow constructed.";
...
}


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.

nix
17th August 2011, 11:47
Check if QT_NO_DEBUG_OUTPUT is defined at compilation time (look to your compile command) or check if there is any use of
QtMsgHandler qInstallMsgHandler ( QtMsgHandler handler )

stampede
17th August 2011, 12:11
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.

Rikonator
17th August 2011, 12:28
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.

stampede
17th August 2011, 12:33
Have you tried to run your app from cmd line, or gdb ?

Rikonator
17th August 2011, 12:57
It worked with gdb. Thank you so much!

Now on to exterminate 'em bugs.