I work in already compiled (in debug mode) C++ project. I have its exe file and pdb file. I can run the exe from command line.
How can I debug the project? (I so not have its .sln
file.)
I work in Visual Studio, but I also have a cygwin in the system.
Just use File/Open Project/Solution, select EXE file and Open it. Then select Debug/Start debugging. The other option is to run the EXE first and then Select Debug/Attach to process. Save this answer.
To do that, open C++ file in VSCode and either hit F5 or go to Debug -> Start Debugging and select C++ (GDB/LLDB) then select g++.exe build and debug active file . Notice that I've added one more optional configuration g++ build & run active file in launch.
Open the executable from Visual Studio, in the same way as you would open a project or a solution. That will allow you to debug it.
(It creates an empty place-holder solution around your exe, which you can use to change environment variables or command-line arguments when you run the exe to debug it.)
Start a Visual Studio command prompt, and run the following command:
devenv /debugexe yourapp.exe
It must be equivalent to opening the executable file in Visual Studio as Macke suggested in his answer.
You can then press e.g. F10 for the debugger to stop in the beginning of app execution, or set a breakpoint as usual, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With