11.1 Debugging Features

The following list contains the features that are included in the Debug version of the Microsoft Foundation Class Library:

Dump member function to dump object contents to debugging output

Trace output

Assertions and AssertValid member function

Memory diagnostics to detect memory leaks

DEBUG_NEW macro to show where objects were allocated

·To enable the debugging features:

1.Compile with the symbol _DEBUG defined. This is typically done by passing the /D_DEBUG flag on the compiler command line. Defining the _DEBUG symbol allows sections of code delimited by #ifdef _DEBUG / #endif to be compiled.

2.Link with the Debug versions of the Microsoft Foundation Class Library. The Debug versions of the library have a “D” at the end of the library name. For example, the medium-model Debug version of the Microsoft Foundation Class Library for Windows is named MAFXCWD.LIB, and the Release version (non-debug) is named MAFXCW.LIB.