本文介绍了调试基于 Linux 的 C++ 代码 Visual Studio 代码时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Linux - Ubuntu 中的 visual studio code 中调试我的代码.我已经按照规范配置了调试配置.但是在尝试调试时,我收到以下错误.

I am trying to debug my code in visual studio code in Linux - Ubuntu. I have configured the debugging configurations according to the specification. But when trying to debug I am getting the following error.

=thread-group- added,id="i1" GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1 版权所有 (C) 2016 Free Software Foundation, Inc. 许可证 GPLv3+:GNU GPL 版本 3 或更高版本http://gnu.org/licenses/gpl.html这是免费软件:您可以自由更改和重新分发它.在法律允许的范围内,不提供任何保证.输入显示复制"和显示保修"的详细信息.这个 GDB 被配置为x86_64-linux-gnu".输入show configuration"进行配置细节.有关错误报告的说明,请参阅: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 在遇到对未链接库的库调用时会输出此错误.

Because not all libraries (.a, .so) are linked to you project. I had the same problem. gdb outputs this error when it encounters a library call to a library that is not linked.

这篇关于调试基于 Linux 的 C++ 代码 Visual Studio 代码时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 15:50