【问题标题】:MinGW C++ and vscode pretty printing debug not workingMinGW C++ 和 vscode 漂亮的打印调试不起作用
【发布时间】:2020-03-25 23:21:09
【问题描述】:

我想弄清楚为什么漂亮的打印不能正常工作。我已经查看了很多地方,试图找出它为什么不起作用,但我还没有找到解决方案。

问题来了:

vscode screenshot

如您所见,矢量state 没有显示其元素。这是我的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"
}

【问题讨论】:

    标签: c++ visual-studio-code mingw


    【解决方案1】:

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

    How to enable gdb pretty printing for C++ STL objects in Eclipse CDT?

    我按照以下说明进行操作:

    这适用于使用 Eclipse CDT 的 MinGW 用户

    我将.gdbinit 放在我的 cpp 项目文件夹根目录中以供参考。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-13
      • 1970-01-01
      • 2014-02-22
      • 1970-01-01
      • 2020-07-07
      • 2014-08-05
      • 2012-01-11
      • 2013-03-19
      相关资源
      最近更新 更多