You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows下VSCode调试无法正常查看vector变量问题求助

Windows下VSCode调试vector变量显示异常问题

刚切换到Windows系统使用VSCode,调试时无法正常查看vector变量,显示内容十分复杂,怀疑该问题与launch.json、tasks.json、c_cpp_properties.json或settings.json配置有关。以下是相关配置文件:

相关配置文件

c_cpp_properties.json

{
  "configurations": [
    {
      "name": "windows-gcc-x86",
      "includePath": [
        "${workspaceFolder}/**"
      ],
      "compilerPath": "C:/MinGW/bin/gcc.exe",
      "cStandard": "${default}",
      "cppStandard": "${default}",
      "intelliSenseMode": "windows-gcc-x86",
      "browse": {
        "path": [
          "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true,
        "databaseFilename": ""
      },
      "compilerArgs": [
        "-03"
      ]
    }
  ],
  "version": 4
}

settings.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++ build active file",
            "command": "C:/MinGW/bin/g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}",
                "-std=c++17"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
            
        }
    ]
}

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "C/C++ Runner: Debug Session",
      "type": "cppdbg",
      "request": "launch",
      "args": [],
      "stopAtEntry": false,
      "externalConsole": true,
      "cwd": "c:/Users/DELL/Desktop/code",
      "program": "c:/Users/DELL/Desktop/code/build/Debug/outDebug",
      "MIMode": "gdb",
      "miDebuggerPath": "gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ],
      "preLaunchTask" :  "C/C++: g++.exe build active file"
    }
  ]
}

注:MacOS下调试时vector变量可正常显示,Windows下显示异常。

内容的提问来源于stack exchange,提问作者WhoDuck

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 18:41:13