G plus plus

g++ is the front-end for gcc that builds C++ code. When you compile a .c file (C language source code), you invoke the gcc command, when you compile a .cpp file (C++ language source code), you invoke the g++ command.

The call g++ main.cpp is about equivalent to gcc -lstdc++ main.cpp