|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
/Z7, /Zd, /Zi, /ZI (Debug Information Format)
The Debug Information Format options select the type of debugging information created for your program and whether this information is kept in object (.obj) files or in a program database (PDB).
|None of these options||Produces no debugging information, so compilation is faster.|
|/Zd||Produces an .obj file or executable (.exe) file containing only global and external symbol and line-number information (no symbolic debugging information). Use this option if you want to reduce the size of the .exe file, or if you don't want to use the debugger's expression evaluator (requires symbolic information).|
|/Z7||Produces an .obj file and an .exe file containing line numbers and full symbolic debugging information for use with the debugger. The symbolic debugging information includes the names and types of variables, as well as functions and line numbers.
/Z7 is not compatible with /clr.
|/Zi||Produces a program database (PDB) that contains type information and symbolic debugging information for use with the debugger. The symbolic debugging information includes the names and types of variables, as well as functions and line numbers.
When compiling with /Zi and /clr, note that the Debuggable attribute will be placed in the assembly metadata. This attribute can affect the runtime performance of the application. For more information about how the Debuggable attribute affects performance and how you can modify the performance impact, see Making an Image Easier to Debug.
|/ZI||Produces a program database, as described above, in a format that supports the Edit and Continue feature. If you want to use Edit and Continue debugging, you must use this option. Because most optimizations are incompatible with Edit and Continue, using /ZI disables any |
/ZI causes /Gy to be used in your compilation.
/ZI is not compatible with /clr.
The compiler names the program database project.pdb. If you compile a file without a project, the compiler creates a database named VCx0.pdb., where x is the major version of Visual C++ in use. The compiler embeds the name of the PDB in each .obj file created using this option, pointing the debugger to the location of symbolic and line-number information. When you use this option, your .obj files will be smaller, because debugging information is stored in the .pdb file rather than in .obj files.
If you create a library from objects that were compiled using this option, the associated .pdb file must be available when the library is linked to a program. Thus, if you distribute the library, you must distribute the PDB.
Note To create a library that contains debugging information without using .pdb files, you must select the compiler's C 7.0-Compatible (/Z7) option. If you use the precompiled headers options, debugging information for both the precompiled header and the rest of the source code is placed in the PDB. The /Yd option is ignored when the Program Database option is specified.
To set this compiler option in the Visual Studio development environment
- Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
- Click the C/C++ folder.
- Click the General property page.
- Modify the Debug Information Format property.
To set this compiler option programmatically