In all my previous C++ projects I used the gcc as compiler.
For some reasons I want to try out the Sun compiler instead.
How can I install and use this compiler instead?
Is the Sun C++ compiler pre-installed on Linux resp. Solaris?
No C++ compilers are "pre-installed" under Solaris. As far as I
know, most Linux distributions do include a version of g++, but
none (again as far as I know) include Sun CC. For corporate
use, I'd contact Sun for the C++ compiler for both platforms.
(The product name is actually Sun Studio 12, and it includes C,
C++ and Fortran.) I think a free version is also available, but
I've not experimented with it. For g++ for Solaris, I find it
easy enough to build myself from the downloaded sources, but Sun
used to make precompiled versions available as well. (Sun also
has a version of gcc 4.2.0 available which will use the Sun
optimizer.)
Under Solaris, you invoke g++ with the command "g++", and Sun
C++ with the command "CC". Provided your $PATH is set
correctly, of course. But you'll still need to look at the
docs; neither compiler is really usable with just the default
options, and you'll need to work out which options are best for
your situation.