C++ “如何修复”;应为“文件结尾”;JSON设置与代码?

C++ “如何修复”;应为“文件结尾”;JSON设置与代码?,c++,json,visual-studio-code,C++,Json,Visual Studio Code,您发布的内容不是有效的json。您有几个打字错误,包括: 第7行的一组空的花括号{},后面是几个没有用花括号括起来的键值属性对 这可能更接近您想要的: { "workbench.colorTheme": "Default Dark+" } { } "name": "C++ Launch", "type": "cppdbg", &qu

您发布的内容不是有效的json。您有几个打字错误,包括:

  • 第7行的一组空的花括号
    {}
    ,后面是几个没有用花括号括起来的键值属性对
这可能更接近您想要的:

{
    
"workbench.colorTheme": "Default Dark+"

}

{ }
   
"name": "C++ Launch",
    
"type": "cppdbg",

    "request": "launch",
    "program": "${workspaceFolder}/a.out",
    "stopAtEntry": false,
    "customLaunchSetupCommands": [
      { "text": "target-run", "description": "run target", "ignoreFailures": false }
    ],
    "launchCompleteCommand": "exec-run",
    "linux": {
      "MIMode": "gdb",
      "miDebuggerPath": "/usr/bin/gdb"
    },
    "osx": {
      "MIMode": "lldb"
    },
    "windows": {
      "MIMode": "gdb",
      "miDebuggerPath": "C:\\MinGw\\bin\\gdb.exe"
    }
  }

顺便说一句,为什么你的json中有{},而最后一个}根本没有{。谢谢你,这真的很有帮助。我现在明白了。
{
  "workbench.colorTheme": "Default Dark+",
  "name": "C++ Launch",
  "type": "cppdbg",
  "request": "launch",
  "program": "${workspaceFolder}/a.out",
  "stopAtEntry": false,
  "customLaunchSetupCommands": [
    {
      "text": "target-run",
      "description": "run target",
      "ignoreFailures": false
    }
  ],
  "launchCompleteCommand": "exec-run",
  "linux": {
    "MIMode": "gdb",
    "miDebuggerPath": "/usr/bin/gdb"
  },
  "osx": {
    "MIMode": "lldb"
  },
  "windows": {
    "MIMode": "gdb",
    "miDebuggerPath": "C:\\MinGw\\bin\\gdb.exe"
  }
}