- .vscode文件夹(注意vscode前的.)目录下有:
– launch.json
– settings.json
– tasks.json
三个文档
以下为各个文档内容(其中部分内容请按自己计算机实际情况进行配置):
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
"version": "0.2.0",
"configurations": [
{
"name": "c++ Launch", //配置文件的名字.因为一个launch里可以有好几个配置文件
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "E:\\mingw64\\bin\\gdb.exe",//调试器的位置
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "Build"
}
]
}
settings.json
{
"files.associations": {
"new": "cpp",
"iostream": "cpp",
"limits": "cpp",
"array": "cpp",
"*.tcc": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"memory": "cpp",
"optional": "cpp",
"string_view": "cpp",
"fstream": "cpp",
"istream": "cpp",
"ostream": "cpp",
"vector": "cpp",
"sstream": "cpp",
"streambuf": "cpp",
"tuple": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"algorithm": "cpp",
"regex": "cpp",
"valarray": "cpp",
"deque": "cpp",
"cctype": "cpp",
"atomic": "cpp",
"cfenv": "cpp",
"charconv": "cpp",
"cinttypes": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"csetjmp": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cuchar": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"forward_list": "cpp",
"list": "cpp",
"unordered_set": "cpp",
"exception": "cpp",
"functional": "cpp",
"iterator": "cpp",
"map": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"random": "cpp",
"ratio": "cpp",
"set": "cpp",
"system_error": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"mutex": "cpp",
"scoped_allocator": "cpp",
"shared_mutex": "cpp",
"stdexcept": "cpp",
"thread": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp"
},
"C_Cpp.errorSquiggles": "Disabled"
}
tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"command": "g++",
"args": [
"-g",
"-Wall",
"-std=c++11",
"-lm",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}.o"
],
"windows": {
"args": [
"-g",
"-Wall",
"-std=c++11",
"-lm",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}.exe"
]
},
"presentation": {
"reveal": "always",
"echo": false,
"focus": true
},
"problemMatcher": {
"owner": "cpp",
"fileLocation": "absolute",
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"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
}
}
]
}