First, set our compiler to GCC.
Window-> preferences-> C/C ++-> New CDT Project Wizard
Select mingw GCC and click the area circled in the red box below.
Create a C ++ project. The Compiler points to mingw GCC by default. Create an empty project and finished it directly.
Because it is an empty project, you need to create a main. cpp file. Of course, it can also be called shit. cpp. Copy the C ++ test file we just wrote into it.
Click the hammer icon and compile it. You do not need to write makefile by yourself. This is so simple.
Compiled directory structure
Most importantly, add the path to the running environment (run environment). Otherwise, the console will not output any information (the command line method will not be affected ).
PS: When you create a C Project, you can output it on the console without configuring this configuration.
Run-> RUN configuration-> select Create Project-> Environment
Manually adjust the pathvariable value to the path of the make.exe file, that is, the value added to the system path.
Click "run" without compiling (the same as the Java icon). If no source file is compiled, the system automatically compiles the file without modifying the source file. The following prompt is displayed.
OK, done!
Good luck, have fun.