今天安裝下載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++.