在 SublimeText 上调试 C++

问题描述 投票:0回答:1

按照https://packagecontrol.io/packages/Debugger在ST中调试python,我注意到.sublime-project获得了一个额外的部分

"debugger_configurations":
[
    {
        "name": "Python: Current File",
        "type": "python",
        "request": "launch",
        "program": "${file}"
    },
],

我尝试在 ST 中为一个简单的 C++ 项目做类似的事情。然后我看到了

"debugger_configurations":
[
    {
        "type": "gdb",
        "request": "launch",
        "name": "Launch Program",
        "target": "./bin/executable",
        "cwd": "${folder}",
        "valuesFormatting": "parseText"
    },
],

我设置了一个断点并点击播放,这导致了

Could not start debugger process, does the program exist in filesystem?
Error: spawn gdb ENOENT
Debugging ended

我改变了

"target": "./myexecutable"
,再次点击播放并得到与之前相同的结果。

可以在ST上调试C++吗?我想知道我哪里出错了。

第二次尝试,使用 lldb 添加:

"debugger_configurations":
[
    {
        "type": "lldb",
        "request": "launch",
        "name": "Launch",
        "program": "${folder}/<program>",
        "args": [],
        "cwd": "${folder}"
    },

点击播放并

控制台处于“命令”模式,表达式前缀为“?”。 无法找到“/Users/user/project/”的可执行文件

然后更改“程序”:“${folder}/${file_base_name}”,

并且得到了

c++ debugging sublimetext
1个回答
0
投票

https://github.com/daveleroy/SublimeDebugger/blob/master/examples/cpp/cpp.sublime-project

"debugger_configurations": [
    {
        "name": "C++ (Console)",
        "type": "lldb",
        "request": "launch",
        "program": "${project_path}",
        "cwd": "${project_path}",
        "terminal": "external",
    },
© www.soinside.com 2019 - 2024. All rights reserved.