The front-end for C++ is g++
. g++
is just a
wrapper script to call gcc
with C++ options. C++ is
a super-set of C; thus, all C options will hold for a C++
compile, and they should (usually) be enough.
You have a number of choices when compiling C++ sources: invoke
g++
, which is the easiest option. The other option is to invoke
gcc
calling the correct language and libraries, for example
g++ -x c++ -lg++
, a little more verbose perhaps.
Not all of the options for compiling with g++
are given here;
many have been left out, and we'll only look at a small selection. The
options that gcc
offer should generally be enough for most
compilations, except under very special curcumstances. You should
consult the documentation for more details.
-fdollars-in-identifiers
| Allow identifiers to contain $ characters in identifiers. By
default this shouldn't be permitted in GNU C++, although it is
enabled on some platforms. -fnodollars-in-identifiers disables
this option if it is default on the machine you're using.
|
-fenum-int-equiv
| Allow conversion of int to enum .
|
-fnonnull-objects
| This option ensures that no extra code is generated for checking whether
any objects reached through references are not null.
|
-Woverloaded-virtual
| Warn when a function in a derived class has the same name as a virtual
function in the base class, but the signature is different.
|
-Wtemplate-debugging
| When using templates, warn if debugging is not available.
|