c++ - 调试 CMake 项目 Visual Studio Code OSX
问题描述
我正在遵循https://medium.com/@dexterchan_44737/visual-studio-code-build-and-debug-ac-with-cmake-on-mac-os-7633bc59bf34的说明,但我没有成功。
我的项目文件夹如下所示:
c_cpp_properties.json
launch.json
tasks.json
build
-- ...
Challenges
--main.cpp
--CMakeLists.txt
CMakeLists.txt
我的一些文件是:
c_cpp_properties.json
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"macFrameworkPath": [
"/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
启动.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Iniciar",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/Challenges/DailyCoding_run",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"targetArchitecture": "x86_64",
"externalConsole": false,
"MIMode": "lldb"
}
]
}
任务.json
{
"version": "2.0.0",
"type": "shell",
"options": {
"cwd": "${workspaceRoot}/build"
},
"tasks": [
{
"label": "cmake",
"command": "cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Debug ..",
"type": "shell",
"presentation": {
"echo": true,
"reveal": "always",
"panel": "shared"
}
},
{
"label": "make",
"command": "make -j 8",
"type": "shell",
"presentation": {
"echo": true,
"reveal": "always",
"panel": "shared"
},
"group": "build"
}
]
}
我将项目构建为
Tasks: Command Palette... > Run Build Task
Start Debugging
它在断点处停止,但无法单击其他任何内容,因为没有回答(无法执行 Step Over、Step Into ...)
解决方案
推荐阅读
- excel - VBA 导出 CSV
- ios - Xcode 12:SDWebImageManager'在不同的模块中有不同的定义;
- python - `pip install psutil` 正在抛出 `error: Unsupported architecture`。任何解决方法?
- mysql - 带有查询字符串的 MySQL 过程
- regex - 如何在较长的段落中为该句子编写正则表达式模式?
- express - 从控制器获取 multerS3 密钥
- java - 方法参数获取所有输入,而不仅仅是双输入
- c - MAX6675 与 PIC18F45k22 通过 UART 数据传输问题
- java - Maven 构建/插件部分继承行为 wrt 到插件版本
- unit-testing - 乔·阿姆斯特朗 (Joe Armstrong) 所说的单元测试“有更先进的技术”指的是什么