This article was previously published under Q163369
This article has been archived. It is offered "as is" and will no longer be updated.
When compiler option /LDd follows /MTd, /MDd or /MLd, _DEBUG is notdefined. This happens only if it is compiled from the command line. The IDEadds this definition by default in the project settings for debug build.
Specify /LDd before /MTd, /MDd or /MLd.
Microsoft has confirmed this to be a bug in the Microsoft products listedat the beginning of this article.
This problem was corrected in Microsoft Visual C++ .NET.
When you use one of the compiler options /MTd, /MDd or /MLd, the symbol_DEBUG is automatically defined. However, if /LDd follows any of theseoptions on the compiler command line, then _DEBUG is not definedautomatically.
Steps to Reproduce Behavior
// x.cpp or x.c // Compile options needed to reproduce: /c /MTd /LDd // Compile options for workaround: /c /LDd /MTd #ifdef _DEBUG # pragma message("_DEBUG is defined") #else # pragma message("_DEBUG is not defined") #endif