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的安装位置,要根据自己的安装位置修改一下

相关推荐
wefg139 分钟前
【C++】类与对象
开发语言·c++
子豪-中国机器人1 小时前
C++ 蓝桥 STEMA 省选拔赛模拟测试题(第一套)
开发语言·c++·算法
虾球xz1 小时前
游戏引擎学习第286天:开始解耦实体行为
c++·人工智能·学习·游戏引擎
zh_xuan3 小时前
c++ 类的语法3
开发语言·c++
一律清风4 小时前
【Opencv】canny边缘检测提取中心坐标
c++·opencv
a东方青8 小时前
蓝桥杯 2024 C++国 B最小字符串
c++·职场和发展·蓝桥杯
无声旅者10 小时前
深度解析 IDEA 集成 Continue 插件:提升开发效率的全流程指南
java·ide·ai·intellij-idea·ai编程·continue·openapi
XiaoyaoCarter10 小时前
每日一道leetcode
c++·算法·leetcode·职场和发展·二分查找·深度优先·前缀树
galaxy_strive10 小时前
qtc++ qdebug日志生成
开发语言·c++·qt
Darkwanderor10 小时前
c++STL-list的模拟实现
c++·list