visual-studio-code - macOS 上带有 c++ ext 的 VS Code 无法调试我的代码
问题描述
我安装了插件并编写了默认配置,但是断点和调用堆栈并没有绑定到 vs 代码。
启动.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"
}
]
}
任务.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).
我究竟做错了什么?
解决方案
@atombit,只是,替换g++
为clang++
!
推荐阅读
- python - Tornado 服务器的多个异步 HTTP 连接
- .htaccess - 将带有 301 的域和子页面重定向到新域
- r - R Studio 对 Run All 没有反应
- string - 从数据框中删除字符串模式(RStudio 中的 Twitter 数据)
- angular - 在没有 npm install 命令的情况下安装 Angular
- c++ - 如何使用 Visual Studio 2017 编译 CEF 库?
- c# - 不同的视图取决于模型属性
- android - 如何解决缺少 R 类的问题?
- sql-server - sql server 配置管理器和服务中缺少 sql 服务
- buffer - Verilog VGA 缓冲区未按预期工作