Qt qDebug not working with QConsoleApplication or QApplication
-
I currently have a terribly annoying problem while developing programs using Qt and Qt Creator. Whenever I try using qDebug() with a QCoreApplication or QApplication instantiated before using qDebug(), there isn't any output, whether I run the program in Qt Creator or from a normal shell(I'm using Fedora Linux btw). For example, even the following simple code fails:
int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); qDebug() << "TestOutput!" << endl; }
Does anybody know what to do about this problem? Thanks in advance, Marius
-
Hi and welcome to devnet,
Can you build your code sample ? You're not returning anything from main.
On OS X, no problem
-
Just obvious - check if you do not have QT_NO_DEBUG_OUTPUT defined.
Another possibility on Windows I've seen such effects when wrong dll (from other Qt version ) were picked up. -
@SGaist said:
Hi and welcome to devnet,
Can you build your code sample ? You're not returning anything from main.
On OS X, no problem
@alex_malyu said:
Just obvious - check if you do not have QT_NO_DEBUG_OUTPUT defined.
Another possibility on Windows I've seen such effects when wrong dll (from other Qt version ) were picked up.Yes it runs, and when I build it using Qt4 on the same system, I can see the desired output. I've tested the exactly same code in a freshly installed Fedora 22 system, it's compiling and running without problems, so I figured it has something to do with my system's configuration, but I don't know what it could be, I've already tried reinstalling the Qt packages using dnf/yum, but still no luck. I've also removed all packages I've installed in the last couple days, and did downgrades, because saturday everything was OK and working...
EDIT: When using
qWarning()
instead ofqDebug()
, I get the output. But still, I want to find out, whats the origin of this strange problem. Otherwise, I have to reinstall my whole OS, which would be pretty annoying... -
OK guys, I was able to solve the problem. The Fedora people changed a configuration file, so that qDebug output wasn't shown to the user anymore, until the user changed the settings like described here:
https://bugzilla.redhat.com/show_bug.cgi?id=1227295