1.配置c编译器开发

6 阅读1分钟

windows 配置c编译器

从github下载c编译器,并使用vscode开发

  • 下载:github下载
  • 下载后解压到某个文件夹(注意文件夹名字不能有空格),如:D:\mingw64
  • 然后将 D:\mingw64\bin 加入到环境变量里,为了在cmd能访问 gcc

vscode开发第一个hello world

  • 打开vscode某个文件夹
  • 编写c代码,文件:hello.c
#include <stdio.h>

int main()
{
    printf("Hello world!");
    return 0;
}
  • 打开vscode终端编译(Ctrl+~):
    • gcc .\hello.c -o .\hello.exe
  • 运行编译后的:
    • .\hello.exe