vscode配置C环境
-
win11安装MinGW
-
进入github
-
下载压缩包
-
直接解压后移动到指定目录,配置环境变量
Path=C:\Program Files\mingw64\bin
- 验证
C:\Users\dogle>gcc --version
gcc (x86_64-win32-seh-rev0, Built by MinGW-W64 project) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\Users\dogle>g++ --version
g++ (x86_64-win32-seh-rev0, Built by MinGW-W64 project) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\Users\dogle>gdb --version
GNU gdb (GDB) 11.2
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
- 安装vscode,安装插件
C/C++
C/C++ Extension Pack
Code Runner
- 新建文件test.c,使用vscode打开
#include <stdio.h>
int main()
{
/* 我的第一个 C 程序 */
printf("Hello, World! \n");
return 0;
}
-
点击右下角配置MinGW的g++路径,参考
-
查看配置
"C_Cpp.default.compilerPath": "c:\\Program Files\\mingw64\\bin\\g++.exe",
-
点击右上角调试,生成test.exe
-
点击右上角执行
输出
[Running] cd "d:\workspaces\" && gcc test.c -o test && "d:\workspaces\"test
Hello, World!
[Done] exited with code=0 in 0.538 seconds
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· .NET Core 中如何实现缓存的预热?
· 三行代码完成国际化适配,妙~啊~
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
2022-05-07 加解密:签名算法、数字证书
2022-05-07 加解密:密钥交换算法、非对称加密算法
2022-05-07 加解密:对称加密算法、口令加密算法
2022-05-07 加解密:BouncyCastle、Hmac算法
2022-05-07 加解密:编码算法、哈希算法
2022-05-07 序列化与反序列化
2021-05-07 vue2.0入门