MFC Debugging Support

The Microsoft Foundation Class Library (MFC) and Visual C++ help you debug your applications in a variety of ways. This topic presents a few useful general debugging techniques, followed by more detailed debugging topics.

The Microsoft Foundation Class Library (MFC) contains many diagnostic features to help debug your program during development, such as the Dump and AssertValid member functions, the TRACE and ASSERT macros, the AfxEnableMemoryTracking and AfxDebugBreak global functions, and the CMemoryState class to detect memory leaks.

Because diagnostics slow down and interrupt your application, they are not suitable for a release version. When you are developing your program, you typically build a Win32 Debug version of your program and link with the debug version of MFC. Once the program is completed and debugged, you build a Win32 Release version and link with the release version of MFC. You can easily switch between Win32 Debug and Win32 Release by setting the Select Active Configuration droplist.

Following are several techniques for debugging your MFC application:

For additional information specific to MFC debugging, see the following topics: