简体   繁体   English

std::string 显示为<incomplete type>在调试器中</incomplete>

[英]std::string displayed as <incomplete type> in the debugger

I want to debug my project using vscode, but when i debug all std::string values are shown as incomplete type .我想使用 vscode 调试我的项目,但是当我调试时,所有 std::string 值都显示为incomplete type in the launch.json i have:在 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) 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"
        }   
    ]
    
}

what should i do to solve the problem?我应该怎么做才能解决这个问题?

Since you are using clang you have 2 options to solve "incomplete type" problem:由于您使用的是clang ,因此您有 2 个选项来解决“不完整类型”问题:

  1. This is clang specific problem, so if you can use another compiler you can just use gcc instead of clang .这是clang的具体问题,所以如果你可以使用另一个编译器,你可以只使用gcc而不是clang
  2. You can continue using clang but you will have to install debug info for libstdc++ library.您可以继续使用clang ,但您必须为libstdc++库安装调试信息。 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 .对于 Fedora/RedHat/CentOS 使用sudo dnf debuginfo-install libstdc++-<some_version_here>.x86_64 ,参见https://stackoverflow.com/a/42031150/72178 For Ubuntu/Debian use sudo apt-get install libstdc++6-dbgsym , see https://stackoverflow.com/a/65565897/72178 .对于 Ubuntu/Debian,请使用sudo apt-get install libstdc++6-dbgsym ,请参阅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 .您还可以将clang-fno-limit-debug-info选项一起使用,请参阅https://stackoverflow.com/a/58527425/72178

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM