/Z{d|7|i|I}
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 and 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. Because most optimizations are incompatible with Edit and Continue, using /ZI disables any #pragma optimize statements in your code.
/ZI causes /Gy to be used in your compilation. |
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). 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.
Compiler Options | Setting Compiler Options