Probably I'm a bit late into the party (5 years only) but I'm sure this will help someone specially people that is learning or starting...
When you compile, you get the
.exe together with a
.pdb file
What is a
.pdb file? It's the brother of the pdf ! ... Nah, it's a
Portable Debug Database.
In short words, you own the code, you own a portable debug file and the .exe to run the code.
On the other hand we need something to inspect that code on runtime, put breakpoints, etc...
That's when the IDE comes in play. And I say IDE because you're not limited to Visual Studio only, neither to a specific version.
For example, I will run an old version OTHire which is adviced to compile with VC++ 2010 Express Edition:
https://github.com/Ezzz-dev/OTHire/wiki/Compiling-under-Windows-(Visual-Studio-2010)
I know I can also compile with newest Visual Studio version:
But for demo purposes, I will compile this one with VC++ 2010 Express Edition as per specification:
We put the .pdb file together with the .exe where the server is running:
Then we attach the debugger to the running process:
And we have the debugger connected:
As you see, we can compile with VC++ Express 2010 and we debug with Visual Studio 2022.
Now we can put breakpoints, jump into the code and debug normally. This is also very useful when you don't have the pdb files and you're getting errors in programs that you don't own the code.