The command g++ invokes the C++ compiler from the GNU Compiler Collection (GCC). C++ source files conventionally use one of the suffixes .C, .cc, .cpp, .c++, .cp, or .cxx; preprocessed C++ files use the suffix .ii. GCC recognizes files with these names and compiles them as C++ even when invoked as gcc. However, C++ programs often require additional class libraries, and under some circumstances you might want to compile programs from standard input, or otherwise without a suffix that flags them as C++ programs. g++ is a program that calls GCC with the default language set to C++, and automatically specifies linking against the C++ library.

When you compile C++ programs, you may specify many of the same command-line options that you use for compiling programs in any language; or command-line options meaningful for C and related languages; or options that are meaningful only for C++ programs. These options may be found in the GCC documentation or on the GCC web site.