FIX: LDd Suppresses Implicit Definition of _DEBUG

Article translations Article translations
Article ID: 163369 - View products that this article applies to.
This article was previously published under Q163369
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

SYMPTOMS

When compiler option /LDd follows /MTd, /MDd or /MLd, _DEBUG is not defined. This happens only if it is compiled from the command line. The IDE adds this definition by default in the project settings for debug build.

RESOLUTION

Specify /LDd before /MTd, /MDd or /MLd.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

This problem was corrected in Microsoft Visual C++ .NET.

MORE INFORMATION

When you use one of the compiler options /MTd, /MDd or /MLd, the symbol _DEBUG is automatically defined. However, if /LDd follows any of these options on the compiler command line, then _DEBUG is not defined automatically.

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
				

Properties

Article ID: 163369 - Last Review: February 24, 2014 - Revision: 3.0
APPLIES TO
  • Microsoft Visual C++ 4.0 Standard Edition
  • Microsoft Visual C++ 4.1 Subscription
  • Microsoft Visual C++ 4.2 Enterprise Edition
  • Microsoft Visual C++ 5.0 Enterprise Edition
  • Microsoft Visual C++ 6.0 Enterprise Edition
  • Microsoft Visual C++ 4.2 Professional Edition
  • Microsoft Visual C++ 5.0 Professional Edition
  • Microsoft Visual C++ 6.0 Professional Edition
  • Microsoft Visual C++, 32-bit Learning Edition 6.0
Keywords: 
kbnosurvey kbarchive kbbug kbfix kbnoupdate kbcompiler KB163369

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com