'How to generate .pdb file in Visual Studio 2019 for C++ from command line
I am using cl.exe
C++ compiler in Visual Studio 2019
from the command line. But, I am unable to set the required flag to produce a .pdb file to debug in a separate debugger. I tried /DEBUG:FULL /FI /Fd
, etc., as read in several posts, but no .pdb file is generated.
I also tried to configure the IDE as per different instructions, but still, no .pdb file is created.
What is the command-line flag to be used to produce a .pdb
file?
cl.exe myprogram.cpp /DEBUG:FULL /Fdmyprogram.pdb /Famyprogram.asm /Femyprogram.exe
Solution 1:[1]
The PDB
file is generated by linker, not compiler directly.
Basically, just generate an executable or dll file, by link
ing the *.obj
files.
While GCC
can directly link, the MSVC has a completely different *.exe file for that purpose.
See the docs for linker (
link.exe
):
https://docs.microsoft.com/en-us/cpp/build/reference/linking?view=msvc-160Or compiler (
cl.exe
):
https://docs.microsoft.com/en-us/cpp/build/reference/compiler-command-line-syntax?view=msvc-160
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |