To get access to the tracing, asserts, and reporting facilities in your code, you have to enable the debugging runtime library, and this is done by using the /MDd, /MTd, or /LDd compiler switches, which will define the _DEBUG pre-processor symbol. The _DEBUG pre-processor symbol enables a lot of facilities, and conversely, not defining this symbol will help in optimizing your code.
#ifdef _DEBUG cout << "debug build" << endl; #else cout << "release built" << endl; #endif
The C++ compiler will also provide information through some standard pre-processor symbols. Most of these are useful only for library writers, but there are some that you may want to use.
The ANSI standard says that the __cplusplus symbol should ...