今天安装下载MinGW-W64-install.exe安装MinGW试了好几回都失败了ios
所以决定用离线安装包进行安装c++
1.下载测试
下载地址 https://sourceforge.net/projects/mingw-w64/files/?source=navbarspa
下载后解压到指定目录,如D:\mingw64.net
2.设置环境变量code
set MINGW_HOME=D:\mingw64blog
set path =%MINGW_HOME%\bin\get
3.测试io
(1)新建main.cclass
#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++.