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

相关推荐
_w_z_j_26 分钟前
C++----模拟实现string
开发语言·c++
特立独行的猫a27 分钟前
redis客户端库redis++在嵌入式Linux下的交叉编译及使用
linux·数据库·c++·redis·redis客户端库
张槊哲29 分钟前
const(C++)
开发语言·c++
oioihoii34 分钟前
C++23 中 constexpr 的重要改动
c++·算法·c++23
pystraf1 小时前
UOJ 228 基础数据结构练习题 Solution
数据结构·c++·算法·线段树
牙痛不能吃糖,哭1 小时前
C++面试复习日记(8)2025.4.25,malloc,free和new,delete的区别
开发语言·c++
ChoSeitaku2 小时前
17.QT-Qt窗口-工具栏|状态栏|浮动窗口|设置停靠位置|设置浮动属性|设置移动属性|拉伸系数|添加控件(C++)
c++·qt·命令模式
软行3 小时前
LeetCode 每日一题 2845. 统计趣味子数组的数目
数据结构·c++·算法·leetcode
小贾要学习3 小时前
【C++】继承----下篇
android·java·c++
未来可期LJ3 小时前
【Test】单例模式❗
开发语言·c++