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

VSCode调试配置选择选项重复显示,求解决方法

VSCode调试配置选项重复显示的解决办法
  • 说明:我不住在英语国家,英语水平有限。
  • 问题:调试配置选择选项重复(第1项=第4项,第2项=第5项,第3项=第6项),更换MinGW、多次重启VSCode和电脑后仍未解决。

我的launch.json

{
  "version": "0.2.0",
  "configurations":[
    {
      "name": "C/C++: gcc.exe 活动文件构建及调试",
      "type": "cppdbg",
      "request": "launch",
      "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${fileDirname}",
      "environment": [],
      "externalConsole": false,
      "MIMode": "gdb",
      "miDebuggerPath": "C:\\TDM-GCC-64\\bin\\gdb.exe",
      "setupCommands": [
        {
          "description": "在gdb中使用自动格式化",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        },
        {
          "description": "将反汇编版本设置为Intel格式",
          "text": "-gdb-set disassembly-flavor intel",
          "ignoreFailures": true
        }
      ],
      "preLaunchTask": "C/C++: gcc.exe 活动文件构建"
    },
    {
      "name": "C/C++: g++.exe 活动文件构建及调试",
      "type": "cppdbg",
      "request": "launch",
      "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${fileDirname}",
      "environment": [],
      "externalConsole": false,
      "MIMode": "gdb",
      "miDebuggerPath": "C:\\TDM-GCC-64\\bin\\gdb.exe",
      "setupCommands": [
        {
          "description": "在gdb中使用自动格式化",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        },
        {
          "description": "将反汇编版本设置为Intel格式",
          "text": "-gdb-set disassembly-flavor intel",
          "ignoreFailures": true
        }
      ],
      "preLaunchTask": "C/C++: g++.exe 活动文件构建"
    },
    {
      "name": "C/C++: 已构建文件调试",
      "type": "cppdbg",
      "request": "launch",
      "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${fileDirname}",
      "environment": [],
      "externalConsole": false,
      "MIMode": "gdb",
      "miDebuggerPath": "C:\\TDM-GCC-64\\bin\\gdb.exe",
      "setupCommands": [
        {
          "description": "在gdb中使用自动格式化",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        },
        {
          "description": "将反汇编版本设置为Intel格式",
          "text": "-gdb-set disassembly-flavor intel",
          "ignoreFailures": true
        }
      ]
    }
  ]
}

我的tasks.json

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc.exe 活动文件构建",
            "command": "C:\\TDM-GCC-64\\bin\\gcc.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build"
        },
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe 活动文件构建",
            "command": "C:\\TDM-GCC-64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build"
        }
    ],
    "version": "2.0.0"
}

解决步骤

  1. 检查全局调试配置:按Ctrl+Shift+P呼出命令面板,输入「打开用户设置(JSON)」,查看是否有launch.configurations字段,若存在和工作区重复的调试项,直接删除全局配置里的对应内容。
  2. 确认工作区配置唯一性:打开当前项目的.vscode/launch.json,确保里面只有上述3个配置,无重复条目。
  3. 重置C/C扩展:在扩展面板找到「C/C」扩展,点击右侧齿轮图标选择「重置扩展设置」,之后重启VSCode。
  4. 关闭多余工作区:若同时打开多个VSCode工作区,每个工作区的调试配置会叠加显示,关闭不需要的工作区即可。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.30 05:22:54