g, Zi, Z7

Tells the compiler to generate full debugging information in the object file.

IDE Equivalent

Windows: General > Debug Information Format

Linux: General > Include Debug Information

Mac OS X: General > Generate Debug Information

Architectures

IA-32, Intel® 64, IA-64 architectures

Syntax

Linux and Mac OS X:

-g

Windows:

/Zi

/Z7

Arguments

None

Default

OFF

No debugging information is produced in the object file.

Description

This option tells the compiler to generate symbolic debugging information in the object file for use by debuggers.

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

This option turns off O2 and makes O0 (Linux and Mac OS X) or Od (Windows) the default unless O2 (or another O option) is explicitly specified in the same command line.

On Linux systems using Intel® 64 architecture and Linux and Mac OS X systems using IA-32 architecture, specifying the -g or -O0 option sets the -fno-omit-frame-pointer option.

Alternate Options

Linux: None

Windows: /ZI, /debug