调试基于 Linux 的 C++ 代码 Visual Studio 代码时出现问题
Issue while debugging Linux based C++ code visual studio code
我正在尝试在Linux - Ubuntu的Visual Studio代码中调试我的代码。我已经根据规范配置了调试配置。但是在尝试调试时,我收到以下错误。
=thread-group-added,id="i1" GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1 版权所有 (C) 2016 自由软件基金会公司许可证 GPLv3+: GNU GPL 版本 3 或更高版本 http://gnu.org/licenses/gpl.html 这是自由软件:您可以自由更改和重新分发它。 在法律允许的范围内,没有保证。 键入"显示" 复制"和"显示保修"以了解详细信息。此 GDB 配置为 "x86_64-linux-gnu"。键入"显示配置"进行配置 详。有关错误报告说明,请参阅: http://www.gnu.org/software/gdb/bugs/。查找 GDB 手册和其他 在线文档资源: http://www.gnu.org/software/gdb/documentation/。如需帮助,请键入 "救命"。键入"apropos word"以搜索与"word"相关的命令。 =cmd-param-changed,param="pagination",value="off" 由于共享库事件而停止(未添加或删除库) 已加载 '/lib64/ld-linux-x86-64.so.2'.已加载符号。[劣质 1(过程 18634)退出,代码为0177] 程序 '/home/source/src/.libs/main' 已退出,代码为 177 (0x000000b1)。
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": "C++ Launch",
"type": "cppdbg",
"request": "launch",
"targetArchitecture": "x64",
"program": "${workspaceFolder}/src/.libs/main",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true,
"linux": {
"MIMode": "gdb"
},
"osx": {
"MIMode": "lldb"
},
"windows": {
"MIMode": "gdb"
}
},
]
}
因为并非所有库(.a,.so)都链接到您的项目。我有同样的问题。GDB 在遇到对未链接库的库调用时输出此错误。
您在没有调试信息的情况下编译了程序。使用编译器和链接器选项-g
编译它。
- 为cl.exe(Visual Studio代码)指定命令行C++版本
- Visual studio代码重构似乎不起作用(例如,重命名符号-f2)
- Android Studio 中带有静态库的原生C++代码
- 如何在 Android Studio 4 中编译 C/C++ 原生代码
- 编译并运行后,输出未出现在 Visual Studio 代码中
- 找不到Linux Visual Studio代码C++文件
- 我无法在Visual Studio代码中使用CIN输入答案,它说输入您的年龄,但它说只读文本编辑器如何解决这个问题?
- 为c++配置Visual studio代码
- Visual Studio 中是否有来自代码块的编译器标志的类似物?
- 代码在Visual Studio 2017中不起作用,但在VS代码中工作
- 默认/样板代码在Visual Studio 2017中给我错误.E1574.虚幻.但构建成功了
- 更改 git 分支名称后,在项目的 Visual Studio 代码中丢失智能感知(建议,转到定义C++
- 无法在 Visual Studio 代码中生成和运行 C++ 代码
- Visual Studio 发布模式阻止在调试模式下执行的代码.使用 WinHTTP 和多线程
- 使用Visual Studio 2012编译时,此代码会给我错误,但是使用代码块就可以了
- 如何在不进入 Visual Studio 2015 中的外部库的情况下单步执行我的代码 (F11)
- 用于验证 Visual Studio 一致性开关对生成的代码的影响的工具
- 链接Visual Studio代码中的GLFW
- Visual Studio Community 代码分析的质量与 SAL 注释
- 使用 Visual Studio 代码读取 C++ 中的输入流时出错