#Debugging C++ in Visual Studio Code

16 messages · Page 1 of 1 (latest)

teal raft
#

Hey, I was using clion for C++ development for the longest time and everything just kinda...worked.
Now I'm trying to make the switch to VSC for it because to me that seems more convenient than trying to get vim motions and all my shortcuts working on clion too and maintaining both.

I installed the c/c++ extension and the cmake extension, I got everything to compile just fine and it also works fine. The launch configuration can start the application but simply refuses to hit breakpoints. Im really not sure where to go from here.
cmake kit im using:

{
    "name": "Debug Kit",
    "cmakeSettings": {
        "CMAKE_BUILD_TYPE": "Debug"
    },
    "toolchainFile": "C:/Users/Admin/.vcpkg-clion/vcpkg/scripts/buildsystems/vcpkg.cmake",
    "visualStudio": "138e18eb",
    "visualStudioArchitecture": "x64",
    "isTrusted": true,
    "preferredGenerator": {
        "name": "Ninja"
    }
},

The launch configuration:

{
    "type": "lldb",
    "request": "launch",
    "name": "Debug",
    "program": "${workspaceFolder}/build/Debug/Main.exe",
    "args": [],
    "cwd": "${workspaceFolder}/build/Debug",
},
unkempt fableBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

dawn lodge
#

Modify some .cpp file, build in the terminal using cmake --build your_build_dir --verbose, see if it adds the -g flag

teal raft
#

Im not seeing it

#

I thought Debug build mode should always include debug information by default

#

There is no -g flag when I run it with verbose flag in clion either

dawn lodge
#

Hmm

#

Delete the build directory and build it in VSC again

#

Maybe you didn't do that after setting the mode to debug?

teal raft
#

Well I figured it out and wow

#

I dont even want to talk about it

#

I set the breakpoint at a dumb place and somehow I thought it would be hit without me having to do anything when the app starts

#

Honestly no idea where my brain went

#

Sorry for wasting both of our times 😭

#

!solved

unkempt fableBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity