2、装llvm clang
3、装mingw
4、装插件c/c++ clang、c/c++ for visual studio code、clang-format
5、c源代码
#include <stdio.h>
void work()
{
printf("abc\n");
}
void main()
{
int a;
int b;
a = 3;
b = 4;
int c = a + b;
struct {
int a, b;
float c;
}ww;
work();
ww.a = 1;
ww.b = 21;
ww.c = ww.a + ww.b;
printf("hello world!\n");
}
6、launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch (GDB)",
"type": "cppdbg",
"request": "launch",
"targetArchitecture": "x86",
"program": "${file}.exe",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"args": ["blackkitty", "1221", "# #"],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"externalConsole": true,
"preLaunchTask": "gcc"
}
]
}
7、tasks.json
{
"version": "0.1.0",
"command": "gcc",
"args": ["-g","${file}","-o","${file}.exe"], // 编译命令参数
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
END