The idea behind a debug macro is that it should compile anything if you are in release mode. Try it;
#ifdef _DEBUG #define MESSAGE(x) (std::cout << __FILE__ << " " << __LINE__ << " " << x); #else #define MESSAGE(x) ; #endif int _tmain(int argc, _TCHAR* argv[]) { MESSAGE("Hello"); return 0; }
When you are in release mode, MESSAGE(x) will not have any effect, but in debug mode you will receive a message on the command line.
source share