Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Can't Set QT_DEBUG Flag



  • I'm creating a Qt 6.1.2 app in Windows 10. I've created several Qt apps in Linux. The default setting in LINUX for debug is QT_DEBUG. Evidently this is not the case in Qt 6.1.2 for Windows 10 - it's QT_NO_DEBUG. I'm using cmake and make to build. I've tried everything I can think of in CMakeLists.txt. I even tried changing instances of QT_DEBUG in the QT6.1.2 distribution. How do I get QT_DEBUG set for my build (other than somehow hardcoding it)?



  • @DougyDrumz2
    I can only guess that this is a local configuration issue, since I have seen the debugger working flawlessly with QT_DEBUG under Windows 10 / Qt 6.1.2 / cmake.
    Please check and/or share your project's build settings for the debug configuration and your .pro file.



  • I don't have a *.pro file. I did using linux. However, in linux, I didn't have to set a CONFIG statement to turn on QT_DEBUG, just to turn it off. I'm doing everything via my CMakeLists.txt file. And everything but debug works. Is that feasible, or do I have to have a *.pro file?


  • Lifetime Qt Champion

    What do you create from your CMakeLists.txt - a Makefile or a Visual Studio Solution? If you create Makefile then your CMAKE_BUILD_TYPE must be properly set to either Debug or RelWithDebInfo



  • That didn't work for me either. The only time I see my qDebug() messages is when I run my app in gdb.



  • I looked up Debug and RelWithDebInfo. They add debug symbols to the code. That's not what I'm referring to here. I just want to use qDebug() to output error messages.



  • I've even tried hardcoding every instance of QT_NO_DEBUG to QT_DEBUG. No luck. The only time I see the my qDebug() messages is when I run in gdb.


Log in to reply