1. Install MinGW
There are many steps online for this installation.
2. Configure environment variables, which we add to system variables for ease of use by all users
// Root directory
a.MINGW_PATH=C:/MinGW // The specific path is based on the path of your own installation
// c header file directory
b.C_INCLUDE_PATH=C:\MinGW\include;
// C++ header file directory
c. CPLUS_INCLUDE_PATH=C:\MinGW\include\c++\3.4.5\backward
Because we need to compile C++, just add the C++ path.
3. In the cmd command window
1. Run the dos command to enter the directory where the source code is located
2. Enter the command: g++ hello.cpp
3. You can get the executable file of a.exe
4. Enter the command: a // to run the executable file a.exe