vscode搭建c/c++环境

  1. 安装mingw64

2.vscode安装c/c++插件,run插件

3.在workspace/.vscode文件夹下新建三个文件:

1)c_cpp_properties.json

{

"configurations": [

{

"name": "Win32",

"includePath": [

"${workspaceFolder}/**"

],

"defines": [

"_DEBUG",

"UNICODE",

"_UNICODE"

],

"windowsSdkVersion": "10.0.17763.0",

"compilerPath": "E:\\mingw64\\bin\\g++.exe", /*bin目录下的g++.exe,两个反斜杠\\*/

"cStandard": "c11",

"cppStandard": "c++17",

"intelliSenseMode": "${default}"

}

],

"version": 4

}

2)launch.json

{

"version": "0.2.0",

"configurations": [

{

"name": "g++.exe build and debug active file",

"type": "cppdbg",

"request": "launch",

"program": "{fileDirname}\\\\build\\\\{fileBasenameNoExtension}.exe", /*收纳exe可执行文件*/

"args": [],

"stopAtEntry": false,

"cwd": "${workspaceFolder}",

"environment": [],

"externalConsole": true,

"MIMode": "gdb",

"miDebuggerPath": "E:\\mingw64\\bin\\gdb.exe", /*bin目录下的gdb.exe,两个反斜杠\\*/

"setupCommands": [

{

"description": "为 gdb 启用整齐打印",

"text": "-enable-pretty-printing",

"ignoreFailures": true

}

],

"preLaunchTask": "task g++"

}

]

}

3)tasks.json

{

"tasks": [

{

"type": "cppbuild",

"label": "C/C++: g++.exe 生成活动文件",

"command": "E:\\mingw64\\bin\\g++.exe",

"args": [

"-fdiagnostics-color=always",

"-g",

"${file}",

"-o",

"{fileDirname}\\\\{fileBasenameNoExtension}.exe"

],

"options": {

"cwd": "${fileDirname}"

},

"problemMatcher": [

"$gcc"

],

"group": {

"kind": "build",

"isDefault": true

},

"detail": "调试器生成的任务。"

}

],

"version": "2.0.0"

}

注意:这里三个文件 关于是mingw的安装位置,要根据自己的安装位置修改一下

相关推荐
fqbqrr16 小时前
2601C++,cmake与导入
c++
fqbqrr17 小时前
2601C++,编写自己模块
c++
sun032220 小时前
【VSCode基础】VSCode快捷键总结、工程导入配置等
ide·vscode·编辑器
王老师青少年编程20 小时前
2025年12月GESP真题及题解(C++七级): 城市规划
c++·gesp·csp·信奥赛·七级·csp-s·提高组
寻星探路21 小时前
【算法专题】滑动窗口:从“无重复字符”到“字母异位词”的深度剖析
java·开发语言·c++·人工智能·python·算法·ai
我叫袁小陌1 天前
C++多线程全面详解
开发语言·c++
m0_748250031 天前
C++ 官方文档与标准
开发语言·c++
matlabgoodboy1 天前
程序代做python代编程matlab定制代码编写C++代写plc设计java帮做
c++·python·matlab
DYS_房东的猫1 天前
《 C++ 零基础入门教程》第6章:模板与 STL 算法 —— 写一次,用万次
开发语言·c++·算法
点云SLAM1 天前
C++ 静态初始化顺序问题(SIOF)和SLAM / ROS 工程实战问题
开发语言·c++·slam·静态初始化顺序问题·工程实战技术·c++static 关键字