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

相关推荐
L_09074 小时前
【C++】异常
开发语言·c++
liulilittle4 小时前
关于拥塞控制的几点思考
网络·c++·tcp/ip·计算机网络·信息与通信·tcp·通信
司悠4 小时前
【解决在vscode里开服务器登录codeX后发消息会一直reconnecting】
服务器·ide·vscode
QT-Neal6 小时前
C++ 编码规范
c++
xyz5996 小时前
Astyle对应.clang-format
vscode
啦啦啦啦啦zzzz6 小时前
数据结构:红黑树理论
数据结构·c++·红黑树
Yolo_TvT6 小时前
C++:默认构造函数
c++
维度攻城狮7 小时前
在Vscode连接的Docker容器中使用codex,并配置DeepSeek模型
vscode·docker·codex
小欣加油8 小时前
leetcode994 腐烂的橘子
数据结构·c++·算法·leetcode·bfs
咸鱼翻身小阿橙8 小时前
在VScode使用C#并且调用opencv库
vscode·opencv·c#