我刚刚从 Netbeans 切换到 Visual Studio 代码,并且无法调试 C++,错误是Unable to start debugging. Launch options string provided by the project system is invalid. Unable to determine path...
。
我尝试遵循从 google 搜索到的 Visual Studio Code 网站上的 c/c++ 调试指南,但它无法运行该应用程序,但我可以从Ctrl + Shift + B
所以我的task.json 文件是正确的,所以这是我的task.json 文件和launch.json 文件。
{
//Task.json
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "g++",
"isShellCommand": true,
"args": ["-pipe", "-std=c++14", "${fileBasename}", "-lm"],
"showOutput": "always"
}
//Launch.json
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true,
"linux": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
"osx": {
"MIMode": "lldb"
},
"windows": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
},