I have downloaded the C++ extension and this is my launch.json file.
What should I need to do to debug it? I keep having this error.
Is it possible to debug C++ code on MacOS? Anything I should add/download/create first?
Update : Here is what I did base on answers below and I get this
Visual Studio Code supports the following debuggers for C/C++ depending on the operating system you are using: Linux: GDB. macOS: LLDB or GDB. Windows: the Visual Studio Windows Debugger or GDB (using Cygwin or MinGW)
VSCode can create and auto-configure these files if we try to debug for the first time. 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 .
Setting a breakpoint is easy. Just open the source file you want to debug in Xcode, and click in the margin to the left of the line of code where you want to break. During the debugging session, each time that line is executed, the debugger will break there, and you will be able to debug it.
You cannot use cppvsdbg as the debugger, unless you are using the Visual Studio Windows debugger. For Mac OS X you should be using cppdbg as the debugger type.
Besides that, your program entry points to a directory, not an executable image. Change that to something like "program": "${workspaceRoot}/a.out"
. As documented, this entry "[s]pecifies the full path to executable the debugger will launch or attach to."
More information available at Configuring launch.json for C/C++ debugging.
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