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.
I had the same problem and none of the answers here did help me. I found the solution here: https://lists.fedoraproject.org/archives/list/[email protected]/thread/SB6QJZGVDLWWBZCMTNKMVZSSPPNREOYJ/
I had to set QT_ASSUME_STDERR_HAS_CONSOLE=1. This can be done in code:
qputenv("QT_ASSUME_STDERR_HAS_CONSOLE", "1");
Or better in the "Kits" settings under "Environment".
The solution is simple:
add CONFIG += console
to your .pro file and rebuild the whole project.
If you are running multiple instances of Qt Creator, qDebug does not work properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With