Share via


/Z7, /Zd, /Zi, /ZI   (Debug Info)

OverviewHow Do ICompiler Options

The Debug Info 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).

Command Line Project Settings Description
None of these options None Produces no debugging information, so compilation is faster.
/Zd Line Numbers Only 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 C 7.0- Compatible 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.
/Zi Program Database 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.
/ZI Program Database for "Edit & Continue" 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. Use of the /ZI switch will disable any #pragma optimize statements in your code.

To find these options in the development environment, click Settings on the Project menu. Then click the C/C++ tab, and click General in the Category box.

The compiler names the program database project.PDB. If you compile a file without a project, the compiler creates a database named VC50.PDB. 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 and clear the linker’s Use Program Database (/PDB:NONE) 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.