vscode配置文件

218 阅读1分钟



========================================================

launch.json




{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    // https://github.com/Microsoft/vscode-cpptools/blob/master/launch.md
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch", // 配置名称,将会在启动配置的下拉菜单中显示
            "type": "cppdbg",// 配置类型,这里只能为cppdbg
            "request": "launch", // 请求配置类型,可以为launch(启动)或attach(附加)
            "program": "${fileDirname}/${fileBasenameNoExtension}.o", // 将要进行调试的程序的路径
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "externalConsole": true,
            "environment": [],
            "MIMode": "gdb",
            "windows": {
                "program": "${fileDirname}/${fileBasenameNoExtension}.exe",
                "miDebuggerPath": "D:/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/gdb.exe" // 修改为本机gdb.exe的路径
            },
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "Build"
        }
    ]

}




========================================================

settings.json


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



========================================================


tasks.json


{
    "version": "2.0.0",
    "tasks": [
		{
			"label": "Build",
			"command": "D:/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/g++.exe",
			"type": "shell",
			"args": [
				"-g",
				"-Wall",
				"-std=c++11",
				"-lm",
				"${file}",
				"-o",
				"${fileDirname}/${fileBasenameNoExtension}.exe"
			],
			"presentation": {
				"reveal": "always",
				"echo": true,
				"focus": true
			},
			"problemMatcher": {
				"owner": "cpp",
				"fileLocation": [
					"relative",
					"${workspaceRoot}"
				],
				"pattern": {
					"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
					"file": 1,
					"line": 2,
					"column": 3,
					"severity": 4,
					"message": 5
				}
			},
			"group": {
				"kind": "build",
				"isDefault": true
			}
		},
		{
			"label": "Run",
			"type": "shell",
			"dependsOn": "Build",
			"command": "${fileDirname}/${fileBasenameNoExtension}.o",
			"windows": {
				"command": "${fileDirname}/${fileBasenameNoExtension}.exe"
			},
			"args": [],
			"presentation": {
				"reveal": "always",
				"focus": true
			},
			"problemMatcher": [],
			"group": {
				"kind": "test",
				"isDefault": true
			}
		},
		{
			"type": "shell",
			"label": "C/C++: cpp.exe build active file",
			"command": "D:\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\cpp.exe",
			"args": [
				"-g",
				"${file}",
				"-o",
				"${fileDirname}\\${fileBasenameNoExtension}.exe"
			],
			"options": {
				"cwd": "${workspaceFolder}"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": "build"
		},
		{
			"type": "shell",
			"label": "C/C++: cpp.exe build active file",
			"command": "D:\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\cpp.exe",
			"args": [
				"-g",
				"${file}",
				"-o",
				"${fileDirname}\\${fileBasenameNoExtension}.exe"
			],
			"options": {
				"cwd": "${workspaceFolder}"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": "build"
		}
	]
}




========================================================