'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. 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"
}
]
}
Solution 1:[1]
what should i do to solve the problem?
Since you are using clang you have 2 options to solve "incomplete type" problem:
- This is
clangspecific problem, so if you can use another compiler you can just usegccinstead ofclang. - You can continue using
clangbut you will have to install debug info forlibstdc++library. The exact way how to install it depends on the OS you are using. For Fedora/RedHat/CentOS usesudo dnf debuginfo-install libstdc++-<some_version_here>.x86_64, see https://stackoverflow.com/a/42031150/72178. For Ubuntu/Debian usesudo apt-get install libstdc++6-dbgsym, see https://stackoverflow.com/a/65565897/72178. - You can also use
clangwith-fno-limit-debug-infooption, see https://stackoverflow.com/a/58527425/72178.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
