1. Can a C++ program tell in which mode it was built, i.e. debug or release?
2. Can I access the compile macros, e.g. $(ConfigurationName), from the code?Code:#if BUILD_MODE == DEBUG
#endif
Printable View
1. Can a C++ program tell in which mode it was built, i.e. debug or release?
2. Can I access the compile macros, e.g. $(ConfigurationName), from the code?Code:#if BUILD_MODE == DEBUG
#endif
#ifdef _DEBUG
// Program is compiled in debug mode
#endif
Open Project Properties, C++, Precompiler, Preprocessor definitions. Here you can see all precompiler constants defined in the project. _DEBUG is defined in Debug configuration and not defined in Release configuration. You can add your own constants here and work with them in the code.
$(ConfigurationName) is macro for build tools, it is not available in the code.
Thanks!