You can use either the gcc
or cc
C compilers pretty much interchangeably.
You can mix the g++
and CC
C++ compilers in certain ways, but only on x86 Solaris and if your CC
compiler is new enough to have the -compat=g
option available.
The GNU g++
and the Solaris Studio CC
C++ compilers default to completely different ABIs and C++ run-time libraries. On x86 Solaris platforms, newer versions (since version 12.?, if I remember correctly) provide a -compat=g
option to use the g++ ABI and run-time libraries. The Studio 12.4 CC
compiler adds a -std=v
option to select different versions of the g++ or Sun C++ ABI and run-time libraries:
c++03 (zero-3, not oh-3)
Equivalent to the -compat=g
option. It selects C++ 03 dialect and g++ ABI; it is binary compatible with g++ on Solaris and Linux It
sets the __SUNPRO_CC_COMPAT
preprocessor macro to 'G'.
c++11
Selects C++ 11 dialect and g++ binary compatibility. It sets the __SUNPRO_CC_COMPAT preprocessor
macro to 'G'.
c++0x (zero-x, not oh-x)
Equivalent to c++11.
and
The -std=c++03
provides compatibility with the gcc/g++ compiler on
all Oracle Solaris and Linux platforms.
With -std=c++03
, binary compatibility extends only to shared
(dynamic or .so) libraries, not to individual .o files or archive (.a)
libraries. The gcc headers and libraries used are those provided with
the compiler, rather than the version of gcc installed on the system.
Note that the Studio 12.4 CC
compiler uses the g++
headers and libraries supplied bundled with the CC
compiler itself. 12.3 and earlier use the g++
headers and libraries installed on the system under /usr/sfw
.
On SPARC Solaris, you have to use either g++
or CC
for the entire application.