# Link Debug Information

## Linux*

Use option g at compile time to tell the compiler to generate symbolic debugging information in the object file.

Use option gsplit-dwarf to create a separate object file containing DWARF debug information. Because the DWARF object file is not used by the linker, this reduces the amount of debug information the linker must process and it results in a smaller executable file. See gsplit-dwarf for detailed information.

## macOS

You can link the DWARF debug information from the object files for an executable using dsymutil, a utility included with Xcode*. By linking the debug information in an executable, you eliminate the need to retain object files specifically for debugging purposes.

The utility runs automatically in the following cases:

- When you use the Intel® C++ Compiler to compile directly from source to executable using the command line with option g. For example:

  Example
      icc -g myprogram.c

- When you compile using Xcode*.

In other cases, you must explicitly run dsymutil, such as when you compile using a make file that builds .o files and subsequently links the program.

## Windows*

Use option Z7 at compile time or option debug at link time to tell the compiler to generate symbolic debugging information in the object file. Alternately, use option Zi at link time to generate executables with debug information in the .pdb file.

Parent topic: Compilation