Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In QT,how to distinguish debug and release in someway like preprocessor

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.

like image 555
Aliceljm Avatar asked Apr 07 '13 03:04

Aliceljm


1 Answers

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
}
like image 195
Amartel Avatar answered Oct 10 '22 22:10

Amartel