我安装了插件并编写了默认配置,但断点和调用堆栈未绑定到vs代码。
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}.o",
"args": [],
"stopAtEntry": true,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": true,
"MIMode": "lldb"
}
]
}
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "clang++",
"args": [
"-Wall",
"-std=c++17",
"-g",
"-o",
"${fileBasenameNoExtension}.o",
"${fileBasename}",
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": {
"owner": "cpp",
"fileLocation": [
"relative",
"${fileDirname}"
],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
},
},
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "never",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
}
}
]
}
输出(应用程序刚刚在断点停止时不执行):
Loaded '/Users/mxtnr/xp/coursera-cpp/practices/1.o'. Symbols loaded.
Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger)
The program '/Users/mxtnr/xp/coursera-cpp/practices/1.o' has exited with code 0 (0x00000000).
我在做什么错了?
您的帖子似乎主要是代码;请添加更多详细信息。 看起来您的帖子大部分是代码;请添加更多详细信息。
答案 0 :(得分:0)
@atombit,只需将g++
替换为clang++
!