1. 下载
https://www.mingw-w64.org/downloads/
https://github.com/niXman/mingw-builds-binaries/releases
2.安装
x86_64-12.2.0-release-win32-seh-rt_v10-rev1.7z解压到D盘
我的电脑–属性–系统属性–环境变量–系统变量–path
D:\MinGW-w64\x86_64-12.2.0-release-win32-seh-rt_v10-rev1\mingw64\bin文章来源:https://www.toymoban.com/news/detail-620121.html
C:\Users\Xxxxx>gcc --version
gcc (x86_64-win32-seh-rev1, 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.
3.VSCode中配置gcc
4. 代码
#include <stdio.h>
#define F_PATH "G://GCC//T1//2.c"
int main()
{
/* 我的第一个 C 程序 */
printf("Hello, World! \n");
FILE *fp = NULL;
char tmp[100];
fp = fopen(F_PATH, "r");
if (NULL == fp)
{
printf("File open fail!\n");
return -1;
}
fread(tmp, 1, 100, fp);
printf("%s\n", tmp);
char ch,i=0;
fseek(fp, 0, SEEK_SET);
while ((ch = getc(fp)) != EOF)
{
putchar(ch);
i ++;
}
fclose(fp);
fp = NULL;
// fp = fopen(F_PATH, "a");
// int pos = fputc('d',fp);
// fclose(fp);
// fp = NULL;
return 0;
}
文章来源地址https://www.toymoban.com/news/detail-620121.html
到了这里,关于VSCode搭建GCC环境的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!