Which preprocessor definitions let you identify the build version of a project in VxWorks? I'm looking for something on the lines of _DEBUG (Debug mode)/ _NDEBUG (Release mode) which are used in VC开发者_如何学Python++.
#ifdef _DEBUG
string strBuildMode = "Debug";
#else
string strBuildMode = "Release";
#endif
The standard macro (also supported by VC++) is NDEBUG
. It has negative logic: it's defined in release builds. The documented function is to turn assert()
(from <cassert>
) off.
You can add a switch -DDEBUG in the 'tool flags' options of the build properties for debug mode (along with -g option). The macro can then be used in the program to identify the build mode.
精彩评论