STD :: String显示为<不完整的类型>在调试器中

发布于 2025-01-24 16:04:51 字数 1125 浏览 0 评论 0 原文

我想使用VSCODE调试我的项目, 但是,当我调试所有STD ::字符串值时,显示为不完整的类型。在发射中。我有:

{
    // 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) Adapter CLI",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build-debug/cli/src/adapterCli",
            "args": ["${workspaceFolder}/cli/src/config.ini"],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable automatic structuring and indentation for gdb.",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "miDebuggerPath": "/usr/bin/gdb"
        }   
    ]
    
}

I want to debug my project using vscode,
but when i debug all std::string values are shown as incomplete type. in the launch.json i have:

{
    // 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) Adapter CLI",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build-debug/cli/src/adapterCli",
            "args": ["${workspaceFolder}/cli/src/config.ini"],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable automatic structuring and indentation for gdb.",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "miDebuggerPath": "/usr/bin/gdb"
        }   
    ]
    
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

傲娇萝莉攻 2025-01-31 16:04:51

我该怎么办来解决问题?

由于您正在使用 clang 您有2个选项来求解“不完整类型”问题:

  1. 这是 clang 特定问题,因此,如果您可以使用另一个编译器,则可以只使用 GCC 而不是 clang
  2. 您可以继续使用 clang ,但是您必须安装 libstdc ++ library的调试信息。安装方法的确切方法取决于您使用的操作系统。对于fedora/redhat/centos使用 sudo dnf debuginfo-install libstdc ++ - < some_version_here> .x86_64 ,请参阅。对于Ubuntu/debian使用 sudo apt-get install libstdc ++ 6-dbgsym ,请参见
  3. 您还可以使用 clang -fno-limit-debug-info 选项,请参阅 https://stackoverflow.com/a/58527425/72178

what should i do to solve the problem?

Since you are using clang you have 2 options to solve "incomplete type" problem:

  1. This is clang specific problem, so if you can use another compiler you can just use gcc instead of clang.
  2. You can continue using clang but you will have to install debug info for libstdc++ library. The exact way how to install it depends on the OS you are using. For Fedora/RedHat/CentOS use sudo dnf debuginfo-install libstdc++-<some_version_here>.x86_64, see https://stackoverflow.com/a/42031150/72178. For Ubuntu/Debian use sudo apt-get install libstdc++6-dbgsym, see https://stackoverflow.com/a/65565897/72178.
  3. You can also use clang with -fno-limit-debug-info option, see https://stackoverflow.com/a/58527425/72178.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文