1. GCC
GCC (GNU Compiler Collection) is an excellent C ++ compiler and part of the GNU program.
GCC can only be used in Unix or Linux environments at first, and then mingw appears, so that GCC can be used in windows.
2. Install mingw
Mingw can be directly installed or indirectly installed by installing QT creator. Here I install mingw by installing qtcreator-2.4.1.
After installation, the mingw directory is c: \ QT \ qtcreator-2.4.1 \ mingw.
3. environment variable configuration
Add inclue and path to user variables, which are c: \ QT \ qtcreator-2.4.1 \ mingw \ include and c: \ QT \ qtcreator-2.4.1 \ mingw \ bin
4. Compile the connection
Now you can use the GCC command in cmd.
The following sectionCode
// Hello. cpp # include <iostream> int main () {STD: cout <"Hello, world! \ N ";}
Under cmd, switch the directory to the current CPP directory.
Then run gcc-O hello. cpp.
Compile and compile an executable file hello.exe quickly.
Run the command in cmd to display Hello, world!