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

[Solved] Cannot have _DEBUG defined



  • Hi,

    I need to have _DEBUG defined when compiling my symbian project in debug mode. I've added this to my .pro file:

    @CONFIG(debug, debug|release) {
    DEFINES += _DEBUG
    }@

    The problem is that this is never defined. It works fine for any other value (DEBUG without '_', _FOO, MYDEFINE, etc...) but not with _DEBUG, and that's the define I need because I'm using common code used in other projects, platforms and tools...

    I'm using Nokia Qt SDK 1.1 beta.

    Any idea?
    Thanks



  • The GNU compiler automatically defines NDEBUG if this is not a debug build. Maybe you add some lines:
    @
    #ifndef NDEBUG
    #define _DEBUG
    #endif
    @



  • Well, I checked the generated Makefile and my DEFINES line is correct:

    @DEFINES = -DSYMBIAN -DUNICODE -DNETWORKACCESS -D_DEBUG@ and some others

    The problem is that if I do
    @#ifdef _DEBUG
    qDebug() << "test";
    #endif@
    it's not taken into account by:

    • Qt Creator: it stays in a grey area
    • make because my debug output is not displayed


  • Is the Makefile you're looking into acutally used by the make command that Creator calls? I'm regularly trapped by default shadow builds where the Makefile and output is in another directory.

    I just checked with the local Creator and it works as you would expect it.



  • OK, my mistake... Even if I checked lots of things before posting here, I overlook a #undef _DEBUG somewhere in an included header file.
    Thanks for your help


Log in to reply