Intel® C++ Compiler 16.0 User and Reference Guide

g, Zi, Z7

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

Syntax

Linux and OS X:

-g

Windows:

/Zi

/Z7

Arguments

None

Default

OFF

No debugging information is produced in the object file or in a PDB file.

Description

Options -g (Linux* OS and OS X*) and /Z7 (Windows* OS) tell the compiler to generate symbolic debugging information in the object file, which increases the size of the object file. The /Zi option (Windows OS) tells the compiler to generate symbolic debugging information in a PDB file.

Two PDB files are created, one by the compiler, and one by the linker:

Each time it creates a .obj file, the compiler merges debug information into vcx0.pdb.

The linker creates executablename.pdb, which contains debug information for the project's .exe file. The executablename.pdb file 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 O2 and make O0 (Linux OS and OS X) or Od (Windows OS) the default unless O2 (or higher) is explicitly specified in the same command line.

On Linux* OS and OS X*, specifying the -g or -O0 option sets the -fno-omit-frame-pointer option. On Linux* OS, the -debug inline-debug-info option will be enabled by default if you compile with optimizations (option -O2 or higher) and debugging is enabled (option -g).

Note

When option -g is specified, debugging information is generated in the DWARF Version 3 format. Older versions of some analysis tools may require applications to be built with the -gdwarf-2 option to ensure correct operation.

IDE Equivalent

Visual Studio: General > Debug Information Format

Eclipse: General > Include Debug Information

Xcode: General > Generate Debug Information

Alternate Options

/Zi

Linux and OS X: None

Windows: /debug:full, /debug:all, /debug, or /ZI

See Also