首页 > 解决方案 > 为什么 gdb 不能在带有 Visual Studio Code 的 Linux 中工作?

问题描述

我正在使用 Visual Studio Code 但我无法调试我的 c++ 代码。我搜索了很多,但我只找到了一个链接,它对我没有帮助。 关联

以下是我的 launch.json 文件:

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
    {
        "name": "(gdb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/build/mypro",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ]
    }
]

}

错误: vsc 无法打开“raise.c”:无法读取文件(错误:找不到文件(/build/glibc-OTsEL5/glibc-2.27/sysdeps/unix/sysv/linux/raise.c))

当我在 Visual Studio 代码中启动调试器时出现上述错误。请任何对此有想法的人帮助我。提前致谢 !!

标签: c++linuxvisual-studiovisual-studio-codegdb

解决方案


推荐阅读