So I have a project that I am working on with CMake,VCPKG and trying to set it up on Visual Studio (previously I was on VS Code) but I couldn’t get the debugger working (or I used gdb but it was too little information to trace and hunt bugs so I want to swap to VS).
My root folder looks like this:
build/
includes/
src/
CMakeLists.txt
vcpkg.json
My src directory looks like this:
CMakeLists.txt
client/
server/
and client directory looks like this:
main.cpp
CMakeLists.txt
and server directory looks like this:
server.cpp
CMakeLists.txt
I currently open powershell, and run
cmake -B build -S .
as to a documentation I read here
https://learn.microsoft.com/en-us/vcpkg/consume/manifest-mode?tabs=msbuild%2Cbuild-MSBuild.
I then run
cmake –build
build to build my project.
Now I have two executables as shown with the two main source files.
So the issue is I can’t get the Visual Studio debugger to debug client and server exes together and it doesn’t really pick it up as a object to launch, as in when I click the green debug + run button, it says no startup object found.
How can I debug both of my exes together at the same time and also have it be picked up by the IDE (so I can actually click the green build/run button to run them).
I read up that you can try set something called multiple startup projects and try modify that but I think for that to work I have to have 2 different projects. I’ve also tried the attach to process with the debugger, so as I can run them through the build/src/client/Debug/client.exe
and then just attach and try debug but I can only debug one at a time.
Note I can build via the command line and try run them but just not debug through the IDE.
Also my client.exe is a GUI app and it freezes up so everytime I click a button and I move step through my code nothing ever happens unless I let my program continue?
3
- Right-click CMakeLists -> Build or use the command line to compile and generate exe & pdb files.
- Right-click CMakeLists/exe ->
Debug
(Or Right-click ->set as startup item
).
You can click on multiple exes -> Debug
.
Note:
only one process is active in the debugger at any given time.
Switch between processes