Bootstrap

分享我的VScode C++配置

lunar.json

{
  "version": "0.2.0",
  "configurations": [
      {
                       "name": "g++.exe build and debug active file",
                       "type": "cppdbg",
                       "request": "launch",
                       "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
                       "args": [],
                       "stopAtEntry": false,
                       "cwd": "${workspaceFolder}",
                       "environment": [],
                       "externalConsole": false,
                       "MIMode": "gdb",
                       "miDebuggerPath": "D:/mingw64/bin/gdb.exe", //改为你的gdb路径
                       "setupCommands": [
                          {
                              "description": "Enable pretty-printing for gdb",
                              "text": "-enable-pretty-printing",
                              "ignoreFailures": true
                          }
                      ],
                      "preLaunchTask": "C/C++: g++.exe 生成活动文件" 
                 }

  ]
}

tasks.json

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cppbuild",
			"label": "C/C++: g++.exe 生成活动文件",
			"command": "D:/mingw64/bin/g++.exe",       //改为你的g++路径
			"args": [
				"-fdiagnostics-color=always",
				"-g",
				"${file}",
				"-o",
				"${fileDirname}\\${fileBasenameNoExtension}.exe"
			],
			"options": {
				"cwd": "D:/mingw64/bin/"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": {
				"kind": "build",
				"isDefault": true
			},
			"detail": "编译器:D:/mingw64/bin/g++.exe" //这个改为你的g++路径
		},
		{
			"type": "cppbuild",
			"label": "C/C++: g++.exe 生成活动文件", 
			"command": "D:/mingw64/bin/g++.exe",    //改为你的g++路径
			"args": [
				"-fdiagnostics-color=always",
				"-g",
				"${file}",
				"-o",
				"${fileDirname}\\${fileBasenameNoExtension}.exe"
			],
			"options": {
				"cwd": "D:/mingw64/bin/"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": "build",
			"detail": "编译器: D:/mingw64/bin/g++.exe"  //这个也要改
		}
	]
}

c_cpp_properties.json(C++17)

{
  "configurations": [
      {
          "name": "Win32",
          "includePath": [
              "${workspaceFolder}/**"
          ],
          "defines": [
              "_DEBUG",
              "UNICODE",
              "_UNICODE"
          ],
          "cStandard": "c17",
          "cppStandard": "c++17",
          "intelliSenseMode": "gcc-x64",
          "compilerPath": "D:/mingw64/bin/g++.exe"  //改为你的g++路径
      }
  ],
  "version": 4
}

G++在这下载:

下载 - MinGW-w64icon-default.png?t=N7T8https://www.mingw-w64.org/downloads/

;