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盤
我的電腦–屬性–系統(tǒng)屬性–環(huán)境變量–系統(tǒng)變量–path
D:\MinGW-w64\x86_64-12.2.0-release-win32-seh-rt_v10-rev1\mingw64\bin文章來源:http://www.zghlxwxcb.cn/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()
{
/* 我的第一個(gè) 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;
}
文章來源地址http://www.zghlxwxcb.cn/news/detail-620121.html
到了這里,關(guān)于VSCode搭建GCC環(huán)境的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!