7

I know we can use #if DEBUG #else #endif in c#,so i think Qt has the same way to do that, like this:

QString Paths::sqlScriptPath()
{
#if DEBUG
    return "D:\edocclient\edocclient-build-Desktop_Qt_4_8_4_QT4_8_4-Debug\sql";
#else
    return "D:\edocclient\edocclient-build-Desktop_Qt_4_8_4_QT4_8_4-Release\sql";
}

but it didn't work.

Cœur
  • 34,719
  • 24
  • 185
  • 251
Aliceljm
  • 11,041
  • 2
  • 15
  • 21
  • 1
    Similar Question: http://stackoverflow.com/questions/11714118/detect-if-qt-is-running-a-debug-build-at-runtime – warunanc Apr 07 '13 at 04:50

1 Answers1

6

The correct Qt macros for that is QT_DEBUG. So you code will be:

QString Paths::sqlScriptPath()
{
#ifdef QT_DEBUG
    return "D:\edocclient\edocclient-build-Desktop_Qt_4_8_4_QT4_8_4-Debug\sql";
#else
    return "D:\edocclient\edocclient-build-Desktop_Qt_4_8_4_QT4_8_4-Release\sql";
#endif
}
Amartel
  • 4,168
  • 2
  • 14
  • 21