Share via


Use the Full Debug MFC Libraries with Only Selected Debug Modules

Overview

This method allows you to step into the MFC source code as well as providing the other debug facilities. This makes use of both the Debug and Release modes of the Visual C++ makefile, thus making necessary the changes described below (and also making a "rebuild all" necessary when a full release build is required):

  1. On the Build menu, click Set Active Configuration, and then click the release version of the project in the Set Active Project Configuration dialog box.

  2. On the Project menu, click Settings to open the Project Settings dialog box.

  3. In the Microsoft Foundation Classes list box in the General tab, click Use MFC in a Static Library.

  4. In the Category list box in the C/C++ tab, click Preprocessor. Change "NDEBUG" to "_DEBUG" in the Preprocessor definitions text box.

  5. In the Category list box in the Link tab, click Input. Type NAFXCWD.LIB in the Object/library modules text box.

  6. Click OK to save the new build options and close the Project Settings dialog box.

  7. On the Build menu, click Rebuild All. This removes all debug information from your modules, but does not affect the MFC library.

  8. For each project file in which you want to include debug information, follow the steps of Use Per-File Build Options, specifying the desired degree of debug information.

    Note   If you are using an AppWizard-generated application or have precompiled headers, you either have to recompile them before compiling the other modules or turn off the precompiled headers. Warning C4650 and error message C2855 are returned if this is not done correctly.

  9. On the Build menu, click Build <EXE name> to rebuild project files that are out of date.

This includes debug symbols for the selected modules. You are able to set breakpoints only within modules you have compiled using debug information. If you need to reduce the executable size even further, you can use the MFC debug libraries as described in Build the Debug MFC Libraries Without CodeView Information.