mac OS上使用debug报错: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.
Closed this issue · 2 comments
VamosCC commented
🐛 Bug Report(错误报告)
macOS上无法进行调试,会报错: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.然后让我配置launch.json,但我认为launch.json没问题呀。
To Reproduce(重现)
以239题为例,写好:
class Solution {
public:
vector<int> maxSlidingWindow(vector<int> &nums, int k) {
int n = nums.size();
priority_queue<pair<int, int>> q; // numer, index
vector<int> ans;
int l = 0;
for (int r = 0; r < n; r++) {
int cur = nums[r];
q.emplace(cur, r);
while (r - l + 1 >= k) {
ans.emplace_back(q.top().first);
if (q.top().second <= l) q.pop();
l++;
}
}
return ans;
}
};
点击下方的debug,在弹出的框中输入测试用例:[9,10,9,-7,-4,-8,2,-6]\n5
就会报出那个错误。
Expected behavior(预期行为)
预期可以正常开始lldb调试
Extension Output(扩展输出)
Paste here the LeetCode extension log from output channel.(将输出通道中的 LeetCode 扩展日志粘贴到此处。)
Guidance: Press Ctrl+Shift+U
, and toggle the channel to LeetCode
.(按Ctrl+Shift+U
,将频道切换到LeetCode
。)
Your Environment
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "cppdbg",
"request": "launch",
"name": "C++ Debug",
"preLaunchTask": "g++ compile",
"program": "${fileDirname}/${fileBasenameNoExtension}.out",
"args": [],
"environment": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": true,
"MIMode": "lldb"
}
]
}
- os(操作系统): macOs
- extension settings(扩展设置):
- nodejs version(nodejs 版本): v22.2.0
- vscode version(vscode 版本): 版本: 1.90.0 (Universal)
提交: 89de5a8d4d6205e5b11647eb6a74844ca23d2573
日期: 2024-06-04T19:34:44.157Z
Electron: 29.4.0
ElectronBuildId: 9593362
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.2.0 - extension version(扩展版本): v3.2.4
ccagml commented
lldb你在设置里Leetcode-problem-rating: Cpp Compiler 有选择clang吗
VamosCC commented
lldb你在设置里Leetcode-problem-rating: Cpp Compiler 有选择clang吗
嗷,我确实没有改这条,之前是在ubuntu上的配置,直接同步到mac上的,改成clang后就没问题了。非常感谢指导~