Question

Often when I need to debug something it's easier to print something using qDebug() instead of debugging step-by-step using a debugger. The problem is that from time to time the output of qDebug() isn't displayed at all! The same with qWarning and qCritical. What's strange, it only occurs when running the project normally (Ctrl+R), while when debugging (F5) the output shows up.

Was it helpful?

Solution

The solution is simple: add CONFIG += console to your .pro file and rebuild the whole project.

OTHER TIPS

Solution for me, As stated in https://bugzilla.redhat.com/show_bug.cgi?id=1227295#c10 was :

  1. look for qtlogging.ini in /etc/xdg/QtProject/ .
  2. edit the current (or create the file qtlogging.ini if missing)
[Rules]
*.debug=false

to

[Rules]
*.debug=true
qt.*.debug=false
  1. recompile and check!

If you are running multiple instances of Qt Creator, qDebug does not work properly.

My solution for this problem using

Windows 10 Education
Qt Creator (5.x)
Developing a Qt widget.

Problem:

So my issue was whenever I added a QDebug message it didn't show up in the application output although my code was 100% the same as in the tutorial and compiled fine.

Solution:

Right click on the file where you added the QDebug message, for me it was main.cpp. Click build. Press the green arrow on the bottom.

If this still doesn't work go to "Build"->"CleanAll", "Build"->"qMake" and go for the green arrow again.

Of course you have to #include <QDebug> and check that it is well spelled inside your code.

In my case, it is somehow I forgot to click the 'Configure Project'. I am using QTCreator 4.11 and Qt5.14. When I create the project, I did not click on the 'Configure project' near the end of the creation process.

Qt5.14.2, QtCreator 4.12.0: What worked for me was to unselect Projects->Run->Run in Terminal... Duh!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top