How to debug C++ code on VSCode? MacOS

时间:2016-10-20 18:35:37

标签: c++ macos debugging visual-studio-code include-path

I have downloaded the C++ extension and this is my launch.json file. enter image description here

What should I need to do to debug it? I keep having this error. enter image description here

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 enter image description here

1 个答案:

答案 0 :(得分:2)

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.