C++ MinGW C++;vscode打印调试不起作用

C++ MinGW C++;vscode打印调试不起作用,c++,visual-studio-code,mingw,C++,Visual Studio Code,Mingw,我正试图弄明白为什么漂亮的打印不能正常工作。我已经找了很多地方试着找出它不起作用的原因,但我还没有找到解决办法 问题是: 如您所见,向量状态不显示其元素。这是我的launch.json: { "version": "0.2.0", "configurations": [ { "name": "gdb", "type": "cppdbg", "request": "launch",

我正试图弄明白为什么漂亮的打印不能正常工作。我已经找了很多地方试着找出它不起作用的原因,但我还没有找到解决办法

问题是:

如您所见,向量
状态
不显示其元素。这是我的launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "gdb",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "build"
        }
    ]
}
以下是我的tasks.json:

{
    "tasks": [
        {
            "type": "shell",
            "label": "build",
            "command": "C:\\MinGW\\bin\\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "C:\\MinGW\\bin"
            }
        }
    ],
    "version": "2.0.0"
}

我让它工作了。以下是拯救我的帖子:

我按照上面标注的说明进行操作:

这是为使用Eclipse CDT的MinGW用户提供的 我将
.gdbinit
放在我的cpp项目文件夹根目录中以供参考