Many people don't realize that the Sun Studio compilers and tools are now free downloads, and there are many articles and detailed documentation on the developer sites.
In particular, there is often no need to use gcc anymore. Sun Studio C, C++ and Fortran 2000 compilers are state of the art, and free downloads.
Sun Studio 12 has just been released and is also free. C/C++/Fortran compilers, debugger, performance analyzer, and Sun Performance Library. See
Sun Studio: Home of the C, C++ and FORTRAN Compilers and Tools
and
See also:
Commands for Sun Studio 12 Compilers and Tools.