1 下载mingw
https://github.com/niXman/mingw-builds-binaries/releases/download/14.2.0-rt_v12-rev2/x86_64-14.2.0-release-win32-seh-msvcrt-rt_v12-rev2.7z
2 解压到自定义目录 然后此电脑右键-属性-高级系统设置-高级-环境变量-用户变量-path-编辑 新建mingw的bin路径
3 vscode安装c/c++拓展,F5或者右上角调试运行,会自动生成.vscode/tasks.json配置文件
{"tasks": [{"type": "cppbuild","label": "C/C++: gcc.exe 生成活动文件","command": "c:\\programming\\mingw64\\bin\\gcc.exe","args": ["-fdiagnostics-color=always","-g","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe"],"options": {"cwd": "c:\\programming\\mingw64\\bin"},"problemMatcher": ["$gcc"],"group": {"kind": "build","isDefault": true},"detail": "调试器生成的任务。"}],"version": "2.0.0"
}