QDebug doesn't print anything
-
I have this in my code:
@qDebug() << "hello";@But I get nothing on stdout when I run the program in either debug or release mode.
I tried adding CONFIG += console to the project file and rebuilt everything, but it didn't help.
Any ideas? Should I report this as a bug?
EDIT: to clarify, cout, cerr, printf, etc all work fine. I would like to use qDebug because I don't want to write serialization code myself for stuff like QMatrix4x4.
-
just try: QDebug() << "hello";
and include <QDebug> -
[quote author="clochydd" date="1394404924"]just try: QDebug() << "hello";
and include <QDebug>[/quote]Sorry, that was actually what I meant to write. I was just to lazy to actually copy the code. Edited my original post.
-
What Qt version? Qt Project binary or one you built yourself? Platform? Compiler?
Are you defining QT_NO_DEBUG_OUTPUT, QT_NO_WARNING_OUTPUT, or QT_NO_DEBUG_STREAM in your project? -
and QDebug is included?
-
And check that you build your project with CONFIG+=debug
-
Did you run qmake after adding "CONFIG += console"?
[quote author="andreyc" date="1394408559"]And check that you build your project with CONFIG+=debug[/quote]That's for creating debug builds. Release builds can use qDebug() too.
-
[quote author="ChrisW67" date="1394405571"]What Qt version? Qt Project binary or one you built yourself? Platform? Compiler?
Are you defining QT_NO_DEBUG_OUTPUT, QT_NO_WARNING_OUTPUT, or QT_NO_DEBUG_STREAM in your project?
[/quote]I'm running arch linux x86_64 with qtcreator 3.0.1.git-2 from the standard repositories. I've only tried with gcc (GCC) 4.8.2 20140206 (prerelease). I don't define any of those variables in my qmake files.
[quote author="andreyc" date="1394408559"]And check that you build your project with CONFIG+=debug[/quote]
I tried adding that to the build to both the main .pro and those for the subprojects, but no difference :P
-
Did you re-run qmake?
-
[quote author="JKSH" date="1394411428"]Did you re-run qmake?
[/quote]Yes