Debugging Code Compiled with /YX

You can use either the /Zi or the /Z7 option with the /YX option to generate debugging information for CodeView or the integrated debugger.

It is recommended that you use the /Zi option unless you need /Z7 to maintain compatibility with Microsoft C/C++ version 7.0. The /Zi option places the generated debugging information into a program database (PDB); a PDB speeds linking during the debugging process. The /Yd option, which places all debugging information into every object file created using a precompiled header, is ignored unless used with /Z7.

The following table summarizes results obtained from using the /Zi, /Z7, and /Yd options in combination with /YX.

Results of Combining Debugging Options with /YX

Option Result
/Zi Debugging information for both the precompiled header and the rest of the source code is placed in a program database (PDB) with the default name of MSVC.PDB.
/Zi /Yd /Yd is ignored. Debugging information for both the precompiled header and the rest of the source code is placed in a PDB with the default name of MSVC.PDB.
/Z7 Debugging information for both the precompiled header and the rest of the source code is placed in every object file created using the precompiled header.
/Z7 /Yd Debugging information for both the precompiled header and the rest of the source code is placed in every object file created using the precompiled header.

For more information on PDBs, see /Z7, /Zi,  and /Fd. Also see The /Yd (Duplicate Debugging Information in All Object Files) Option.