Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

Zi, Z7

Tells the compiler to generate full debugging information in either an object (.obj) file or a project database (PDB) file.

Syntax

Linux:

See option g.

Windows:

/Zi

/Z7

Arguments

None

Default

OFF

No debugging information is produced.

Description

Option /Z7 tells the compiler to generate symbolic debugging information in the object (.obj) file for use with the debugger. No .pdb file is produced by the compiler.

The /Zi option tells the compiler to generate symbolic debugging information in a program database (PDB) file for use with the debugger. Type information is placed in the .pdb file, and not in the .obj file, resulting in smaller object files in comparison to option /Z7.

When option /Zi is specified, two PDB files are created:

  • The compiler creates the program database project.pdb. If you compile a file without a project, the compiler creates a database named vcx0.pdb, where x represents the major version of Visual C++, for example vc140.pdb.

    This file stores all debugging information for the individual object files and resides in the same directory as the project makefile. If you want to change this name, use option /Fd.

  • The linker creates the program database executablename.pdb.

    This file stores all debug information for the .exe file and resides in the debug subdirectory. It contains full debug information, including function prototypes, not just the type information found in vcx0.pdb.

Both PDB files allow incremental updates. The linker also embeds the path to the .pdb file in the .exe or .dll file that it creates.

The compiler does not support the generation of debugging information in assemblable files. If you specify these options, the resulting object file will contain debugging information, but the assemblable file will not.

These options turn off option /O2 and make option /Od the default unless option /O2 (or higher) is explicitly specified in the same command line.

For more information about the /Z7 and /Zi options, see the Microsoft documentation.

IDE Equivalent

Visual Studio: General > Generate Debug Information

Alternate Options

Linux: -g

Windows: None

See Also