Important: Please read the Qt Code of Conduct -

QT_NO_DEBUG used by files generated by moc

  • Hi guys,

    I am using Qt4 and Qt5 with visual studio and I was stuck on a "bug" that told me that my plugin was compiled in debug when my project was in release, which was not the case.

    After checking lots of thing, I found that the file generated by moc.exe was relying on QT_NO_DEBUG to be defined in Release mod. I looked in Qt documentation and can't find anything about this macro, did I missed something ?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    No you didn't, it's mentioned e.g. "here":

    This macro is defined when you are using Qt in release mode and QT_DEBUG when using the debug mode.

    Are you sure that you didn't forgot to rebuild something ? Or that you where looking in the wrong place for the plugin ?

  • Hi,

    Since I am using Visual Studio and its own build system, I don't have these macro declared by qmake (that I don't use). Is there any place where I can find all macro that are declared by qmake so I can add them to my build system when necessary ?

    The url that you pointed out speaks about enabling/disabling Q_ASSERT, Q_ASSERT_X, and other debugging macro. How can I meet this page when I use a Q_PLUGIN, with the Q_INTERFACES macro that uses QT_NO_DEBUG in the generated MOC file ?

    My feeling is that there is something missing in the plugin documentation or in the general macro you need to provide when compiling Qt base projects and/or moc generated files.

  • Lifetime Qt Champion

    I'd take a look at the qmake manual and if it doesn't contain what you need then go through the source

Log in to reply