MSVC Linker Option : Generate Debug Info

VC++ Linker Option "Generate Debug Info (/DEBUG)" change in VS 2017 and later

Before VS 2017, "Generate Debug Info (/DEBUG)" option (that is, "/DEBUG" with no additional options) defaults to "/DEBUG:FULL" which generates a full PDB file. The .PDB file with "/DEBUG:FULL" option has full private symbols that can be used in another computer. So basically when the PDB is used in another computer, WinDbg (or debugger) will load the private symbol file correctly.

In Visual Studio 2017 and later, new /DEBUG linker option called /DEBUG:FASTLINK was added. /DEBUG:FASTLINK option generates a limited PDB file.

From VS 2017, "Generate Debug Info (/DEBUG)" now defaults to "/DEBUG:FASTLINK" option in VS build.

This means that if you choose "Generate Debug Info (/DEBUG)" option (which is default), it will not generate full private symbol file. If you deploy the PDB file to another computer, you might see the following error in WinDbg when private symbol is required.

        0:000> dv /v
        Unable to enumerate locals, Win32 error 0n87
        Private symbols (symbols.pri) are required for locals.
        Type ".hh dbgerr005" for details.

So if you want to deploy private symbol file to another computer, choose "Generate Debug information optimized for sharing and publishing (/DEBUG:FULL)" option.

The option can be found in Project property pages => Linker => Debugging.


One caveat is if you use "/DEBUG:FASTLINK" PDB file on the same machine where you built AND if you did not remove object files (Debug folder), you will not get an error.