-
安装简体中文语言包
-
安装C/C++插件
-
安装mingw
-
配置系统环境
- 右键此电脑 -> 属性 -> 高级系统设置 -> 环境变量
- 在系统变量中找到Path,双击,点击新建,添加
mingw的bin目录,如:D:\myDate\mingw64\bin - 或运行add_mingw_to_path.bat
-
配置.vscode 文件夹 下载了
code runner插件,可直接运行.cpp,无需配置- 下载
.vscode文件夹 - 对
c_cpp_properties.json、launch.json、tasks.json进行配置
c_cpp_properties.json{ "configurations": [ { "name": "Win32", "includePath": [ "${workspaceFolder}/**" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "cStandard": "c23", "cppStandard": "c++23", "intelliSenseMode": "windows-gcc-x64", "compilerPath": "D:/myDate/mingw64/bin/g++.exe" // 更改为你的`编译器路径` } ], "version": 4 }
launch.json{ "configurations": [ { "name": "C/C++: g++.exe 构建和调试活动文件", "type": "cppdbg", "request": "launch", "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", "environment": [], "externalConsole": false, "MIMode": "gdb", "miDebuggerPath": "D:\\myDate\\mingw64\\bin\\gdb.exe", // // 更改为你的`编译器路径` "setupCommands": [ { "description": "为 gdb 启用整齐打印", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "C/C++: g++.exe 生成活动文件" } ], "version": "2.0.0" }
tasks.json{ "tasks": [ { "type": "cppbuild", "label": "C/C++: g++.exe 生成活动文件", "command": "D:\\myDate\\mingw64\\bin\\g++.exe", // 更改为你的`编译器路径` "args": [ "-fdiagnostics-color=always", "-g", "${file}", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$gcc" ], "group": "build", "detail": "调试器生成的任务。" } ], "version": "2.0.0" }
- 下载
-
重启
vscode,打开一个.cpp文件,按F5,选择C/C++: g++.exe 构建和调试活动文件,即可运行调试
-
Notifications
You must be signed in to change notification settings - Fork 0
writer-liu/vscode-cpp-config
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
vscode安装教程及vscode的c++环境配置方法
Topics
Resources
Stars
Watchers
Forks
Packages 0
No packages published




