Share via


/DEBUG   (Generate Debug Info)

OverviewHow Do ILinker Options

This option creates debugging information for the .EXE file or DLL. When specifying this option, you will also specify a DEBUGTYPE option. (To find this option in the development environment, click Settings on the Project menu. Then click the Link tab, and click Debug in the Category box.)

The linker puts the debugging information into a program database (PDB). It updates the PDB during subsequent builds of the program.

An .EXE file or DLL created for debugging contains the name and path of the corresponding PDB. The debugger reads the embedded name and uses the PDB when you debug the program. The linker uses the base name of the program and the extension .PDB to name the program database, and embeds the path where it was created. To override this default, set the Use Program Database linker option (/PDB:filename on the command line) and specify a different file name in the Program Database Name text box.

The compiler’s Line Numbers Only (/Zd) or C7 Compatible (/Z7) option causes the compiler to leave the debugging information in the .OBJ files. You can also use the Program Database (/Zi) compiler option to store the debugging information in a PDB for the .OBJ file. The linker looks for the object’s PDB first in the absolute path written in the .OBJ file, and then in the directory that contains the .OBJ file. You cannot specify an object's PDB file name or location to the linker.

If the Use Program Database option is not selected (or if /PDB:NONE is specified on the command line), the linker does not create a PDB, but instead puts the debugging information into the .EXE file or DLL.

The Generate Debug Info (/DEBUG) option changes the defaults for the /OPT option from REF to NOREF and from ICF to NOICF.