gcc: Invoking G++

1 
1 3.3 Compiling C++ Programs
1 ==========================
1 
1 C++ source files conventionally use one of the suffixes '.C', '.cc',
1 '.cpp', '.CPP', '.c++', '.cp', or '.cxx'; C++ header files often use
1 '.hh', '.hpp', '.H', or (for shared template code) '.tcc'; and
1 preprocessed C++ files use the suffix '.ii'.  GCC recognizes files with
1 these names and compiles them as C++ programs even if you call the
1 compiler the same way as for compiling C programs (usually with the name
1 'gcc').
1 
1  However, the use of 'gcc' does not add the C++ library.  'g++' is a
1 program that calls GCC and automatically specifies linking against the
1 C++ library.  It treats '.c', '.h' and '.i' files as C++ source files
1 instead of C source files unless '-x' is used.  This program is also
1 useful when precompiling a C header file with a '.h' extension for use
1 in C++ compilations.  On many systems, 'g++' is also installed with the
1 name 'c++'.
1 
1  When you compile C++ programs, you may specify many of the same
1 command-line options that you use for compiling programs in any
1 language; or command-line options meaningful for C and related
11 languages; or options that are meaningful only for C++ programs.  ⇒
 Options Controlling C Dialect C Dialect Options, for explanations of
11 options for languages related to C.  ⇒Options Controlling C++
 Dialect C++ Dialect Options, for explanations of options that are
1 meaningful only for C++ programs.
1