0. Description of the environment:
Win7 Home Edition 64-bit
1. Download the compiler
Https://sourceforge.net/projects/mingw/?source=typ_redirect
:
Note that there are no spaces for the path you select when installing.
2. Installation
The installation process will go to automatically download the manager, after the download is complete, click Continue can continue to install.
3. You will then continue to download the appropriate components, select all options,
Choose the option that you need, I need to use g++ here mainly. Then select Download in installation,
Then, select Apply.
Download process, there will be installation progress tips,
Wait for the download to complete, select close to turn it off.
4. Environment variable Increase path
Choose your own installation path, here is the path to the bin, for example, my is D:\MinGW\bin, add this to the PATH environment variable.
5. Writing code
Test.cpp
#include <iostream>using namespace Std;int main () { cout<< "Hello world!" <<endl; return 0;}
6. Compiling the program
Go to cmd, find the directory where you wrote the code, and then execute
g++-O test.exe test.cpp
7. Execute the program, execute test.exe under Generate Test.exe directory, the word Hello World appears,
Done.
Install GCC under Windows