Does Qt offer a (guaranteed) debug definition?

前端 未结 3 775
后悔当初
后悔当初 2021-02-01 14:26

Does anyone know an officially supported way to include debug-build only code in Qt? For example:

#ifdef QT_DEBUG
// do something
#endif

Basica

3条回答
  •  星月不相逢
    2021-02-01 14:46

    An alternative is to write in your project file something like:

    debug {
      DEFINES += MYPREFIX_DEBUG
    }
    release {
      DEFINES += MYPREFIX_RELEASE
    }
    

    Then you will not depend on the Qt internal definition.

提交回复
热议问题