Visible to Intel only — GUID: GUID-226DE90E-D4C8-420B-B560-0997839D17C4
Visible to Intel only — GUID: GUID-226DE90E-D4C8-420B-B560-0997839D17C4
g
Tells the compiler to generate a level of debugging information in the object file.
Syntax
Linux: |
-g[n] |
macOS: |
-g[n] |
Windows: |
See option Zi, Z7, ZI. |
Arguments
n |
Is the level of debugging information to be generated. Possible values are:
|
Default
-g or -g2 |
The compiler produces complete debug information. |
Description
Option -g tells the compiler to generate symbolic debugging information in the object file, which increases the size of the object file.
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 option -O2 and makes option -O0 the default unless option -O2 (or higher) is explicitly specified in the same command line.
Specifying the -g or -O0 option sets the -fno-omit-frame-pointer option. On Linux*, 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).
Specifying the -g or -O0 option sets the -fno-omit-frame-pointer option.
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: None
Eclipse: General > Include Debug Information
Xcode: General > Generate Debug Information
Alternate Options
Linux: None
Windows: /Zi, /Z7, /ZI