Microsoft KB Archive/201305

= How to debug a Visual C++ 6.0 application by using the Visual C++ 5.0 debugger =

Article ID: 201305

Article Last Modified on 9/30/2005

-

APPLIES TO

 The Integrated Debugger, when used with:  Microsoft Visual C++ 5.0 Enterprise Edition

 Microsoft Visual C++ 6.0 Enterprise Edition

 Microsoft Visual C++ 5.0 Professional Edition

 Microsoft Visual C++ 6.0 Professional Edition</li></ul>

 Microsoft Visual C++ 6.0 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q201305

<div class="summary_section">

SUMMARY
Even though Microsoft Visual C++ 5.0 and Visual C++ 6.0 can coexist on the same computer, debugging a Visual C++ 6.0 application with the Visual C++ 5.0 debugger is a problem because of the differences in the .pdb file formats that are used by each version.

Another problem is the incompatibility between the debug versions of the MFC DLLs. For more information about these incompatibilities, click the following article number to view the article in the Microsoft Knowledge Base:

190487 Various errors occur when you run an MFC debug application with the MFC debug DLLs of another version

<div class="moreinformation_section">

MORE INFORMATION
In Microsoft Developer Studio, an .exe file or a DLL can be opened for debugging. We recommend that you do not open the project (.dsp) or workspace (.dsw) files for a different version of Visual C++ unless you intend to migrate the project to a newer version.

To facilitate debugging, you need to be aware of the following information.

Debugging Visual C++ 5.0 applications or DLLs in the Visual C++ 6.0 Debugger

 * A debug build of an .exe file or a DLL that uses Visual C++ 5.0 MFC code can not be debugged in the Visual C++ 6.0 Debugger as implied in KB article 190487. The same restriction applies to the static library versions of MFC.
 * A release build .exe file, DLL, or static library that uses MFC code can be debugged in the Visual C++ 6.0 Debugger. The PDB file format of Visual C++ 5.0 is recognized by the Visual C++ 6.0 debugger. Therefore, you can build by using the /Zi (Program Database) compiler switch, and preferably without the /pdbtype:sept linker switch when you build an .exe file or a DLL. You may use the /Z7 switch. This switch embeds the debug information in the EXE or DLL when you use the /debug and /pdb:none linker switches. If you use the /Zi switch for a static library, make sure that you also use the compiler switch /Fd"filename", so that a unique PDB file is created.
 * An .exe file, DLL, or static library without MFC code can be debugged in the Visual C++ Debugger whether built for debug or release version with debug information.
 * While stepping into MFC or CRT source code, the line numbers may not match, because the debug information is for the MFC source code shipped with Visual C++ 5.0. However, the sources that are picked up are for the MFC source code that is shipped with Visual C++ 6.0. To change this, click Options on the Developer Support Tools menu. Then, click the Directories tab. Change the sources path to point to the MFC source code for Visual C++ 5.0.

Debugging Visual C++ 6.0 applications or DLLs in the Visual C++ 5.0 Debugger

 * The Visual C++ 6.0-generated PDB file cannot be read by the Visual C++ 5.0 debugger. Therefore, Visual C++ 6.0 projects must be built by using compiler switch /Z7 and linker switch /debug and /pdb:none. We recommend that you do not use the new compiler switch /GZ. This switch introduces run-time checks.
 * MFC code that uses new functionality from Visual C++ 6.0 may not work in the Visual C++ 5.0 Debugger.
 * ATL code must be built with the static version.
 * You may not be able to step into MFC or CRT source code.

Keywords: kbhowto kbinfo kbbug kbdebug KB201305

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.