今天安装下载MinGW-W64-install.exe安装MinGW试了好几次都失败了

因此决定用离线安装包进行安装

1.下载

下载地址 https://sourceforge.net/projects/mingw-w64/files/?source=navbar

MinGW离线安装

下载后解压到指定目录,如D:\mingw64

2.设置环境变量

set MINGW_HOME=D:\mingw64

set path =%MINGW_HOME%\bin\

3.测试

(1)新建main.c

#include <stdio.h>
int main() {
   printf("hello, world! I'm C. ");
   return 0;
}

gcc main.c –o hello_c

hello_c

输出

hello, world! I'm C.

(2)新建main.cpp

#include <iostream>
int main(void)
{
    //cout<<"hello world"<<endl;
    std::cout<<"hello world
!I'm C++.
"; return 0; }

g++ main.cpp –o hello_c++

hello_c++

输出

hello world !I'm C++.

 

 

相关文章:

  • 2021-12-15
  • 2021-05-18
  • 2021-09-03
  • 2021-07-08
  • 2022-12-23
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
猜你喜欢
  • 2022-01-19
  • 2022-12-23
  • 2021-09-14
  • 2021-08-27
  • 2021-07-20
  • 2021-11-22
  • 2022-02-03
相关资源
相似解决方案