vscode配置c++

在.vscode里创建三个文件 c_cpp_properties.json, launch.json, settings.json, tasks.json

c_cpp_properties.json

{
    "configurations": [
      {
        "name": "GCC",
        "includePath": ["${workspaceFolder}/**"],
        "defines": ["_DEBUG", "UNICODE", "_UNICODE"],
        "windowsSdkVersion": "10.0.18362.0",
        "compilerPath": "D:/Code/mingw64/bin/g++.exe",
        "cStandard": "c17",
        "cppStandard": "c++17",
        "intelliSenseMode": "windows-gcc-x64"
      }
    ],
    "version": 4
  }

launch.json

{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "C/C++: g++.exe build and debug active file",
        "type": "cppdbg",
        "request": "launch",
        "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${fileDirname}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "miDebuggerPath": "D:/Code/mingw64/bin/gdb.exe",
        "setupCommands": [
          {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
          }
        ],
        "preLaunchTask": "C/C++: g++.exe build active file"
      }
    ]
  }

setting.json

{
    "files.associations": {
        "iostream": "cpp"
    }
}

tasks.json

{
    "tasks": [
      {
        "type": "cppbuild",
        "label": "C/C++: g++.exe build active file",
        "command": "D:/Code/mingw64/bin/g++.exe",
        "args": [
          "-fdiagnostics-color=always",
          "-g",
          "${file}",
          "-o",
          "${fileDirname}\\${fileBasenameNoExtension}.exe"
        ],
        "options": {
          "cwd": "${fileDirname}"
        },
        "problemMatcher": ["$gcc"],
        "group": {
          "kind": "build",
          "isDefault": true
        },
        "detail": "Task generated by Debugger."
      }
    ],
    "version": "2.0.0"
  }
posted @ 2022-07-15 17:35  douzujun  阅读(339)  评论(0编辑  收藏  举报