Windows配置文件
1. c_cpp_properties.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"browse": {
"path": [
"${workspaceRoot}",
"E:\\MinGW\\lib\\gcc\\mingw32\\8.2.0\\include\\c++"// 自己更改自己对应的地址
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"compilerPath": "E:\\MinGW\\bin\\g++.exe",// 自己更改自己对应的地址
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}2. launch.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29{
// 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": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "E:\\MinGW\\bin\\gdb.exe", // 自己更改自己对应的地址
"preLaunchTask": "build", // 和"tasks.json"的"tasks"-"label"对应
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}3. tasks.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "g++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\build\\${fileBasenameNoExtension}.exe", // 指定输出文件名,不加该参数则默认输出a.exe
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}Ps:
- 在文件夹中创建
build
文件 - 自己更改
MinGW
地址,以及配置MinGW
,点击这里学会如何安装MinGW
,以及如何配置
Windows配置文件(升级)
1. c_cpp_properties.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"browse": {
"path": [
"${workspaceRoot}",
"E:\\MinGW\\lib\\gcc\\mingw32\\8.2.0\\include\\c++"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"compilerPath": "E:\\MinGW\\bin\\g++.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}2. launch.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29{
// 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": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/build/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "E:\\MinGW\\bin\\gdb.exe",
"preLaunchTask": "build",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}3. tasks.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "g++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\build\\${fileBasenameNoExtension}.exe", // 指定输出文件名,不加该参数则默认输出a.exe
// "&&",
"-O0",
"-ggdb3",
"-Wall",
"-lm",
"-std=c++11", // Tag to compile as c++11
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceFolder}"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
]
}Ps:
- 在文件夹中创建
build
文件 - 自己更改
MinGW
地址,以及配置MinGW
,点击这里学会如何安装MinGW
,以及如何配置
插件
1. C/C++
2. C/C++ Complile Run
3. 配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20// Set your c compiler if it is not working
"c-cpp-compile-run.c-compiler": "gcc",
// Flags: e.g. -Wall. default: -Wall -Wextra
"c-cpp-compile-run.c-flags": "-Wall -Wextra",
// Set your cpp compiler if it is not working
"c-cpp-compile-run.cpp-compiler": "g++",
// Flags: e.g. -Wall. default: -Wall -Wextra
"c-cpp-compile-run.cpp-flags": "-Wall -Wextra",
// Run arguments
"c-cpp-compile-run.run-args": "",
// Run in a new external terminal
"c-cpp-compile-run.run-in-external-terminal": false,
// Saves the file before compilation
"c-cpp-compile-run.save-before-compile": true,3. Code Run
4. clang