You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac下Visual Studio Code调试C++报错:需指定MIDebuggerPath

Mac下VS Code调试C++报错:无法确定调试器路径的解决方法

在Mac(arm64架构)上使用VS Code调试C++,已配置tasks.json和launch.json,但点击调试按钮时出现以下错误:

Unable to start debugging. Launch options string provided by the project system is invalid. Unable to determine path to debugger. Please specify the "MIDebuggerPath" option

解决步骤

1. 确认LLDB调试器路径

打开终端,执行以下命令获取LLDB的实际安装路径:

which lldb
  • 若通过Homebrew安装LLDB,路径通常为/opt/homebrew/bin/lldb
  • 系统自带LLDB的路径一般为/usr/bin/lldb

2. 修改launch.json配置

在launch.json的调试配置项中添加MIDebuggerPath字段,填入上一步获取的LLDB路径。修改后的完整配置如下:

{
    "configurations": [
        {
            "name": "C/C++: g++ build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "lldb",
            "targetArchitecture": "arm64",
            "preLaunchTask": "C/C++: g++ build active file",
            "MIDebuggerPath": "/opt/homebrew/bin/lldb" // 替换为你的lldb实际路径
        }
    ],
    "version": "2.0.0"
}

3. 验证配置

保存修改后的launch.json,重新点击调试按钮,即可正常启动调试。

内容的提问来源于stack exchange,提问作者mathworker21

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.19 06:22:37