Sun Studio 12: C++ User's Guide

12.2 Libraries Provided With the C++ Compiler

Several libraries are shipped with the C++ compiler. Some of these libraries are available only in compatibility mode (-compat=4), some are available only in the standard mode (–compat=5), and some are available in both modes. The libgc and libdemangle libraries have a C interface and can be linked to an application in either mode.

The following table lists the libraries that are shipped with the C++ compiler and the modes in which they are available.

Table 12–1 Libraries Shipped With the C++ Compiler



Available Modes 


STLport implementation of the standard library. 



STLport library for debug mode 



C++ runtime 



C++ standard library 



Classic iostreams



C++ runtime, classic iostreams



Supports the -xia option



complex library



Tools.h++ 7

–compat=4,– compat=5


Debug-enabled Tools.h++ 7



Garbage collection 

C interface 



C interface 

Note –

Do not redefine or modify any of the configuration macros for STLport, Rogue Wave or Sun Microsystems C++ libraries. The libraries are configured and built in a way that works with the C++ compiler. libCstd and Tool.h++ are configured to inter-operate so modifying the configuration macros results in programs that will not compile, will not link, or do not run properly.

12.2.1 C++ Library Descriptions

A brief description of each of these libraries follows.


If your compiler software is not installed in the /opt directory, ask your system administrator for the equivalent path on your system.

12.2.2 Accessing the C++ Library Man Pages

The man pages associated with the libraries described in this section are located in:

To access these man pages, ensure that your MANPATH includes /opt/SUNWspro/man (or the equivalent path on your system for the compiler software).

To access man pages for the C++ libraries, type:

example% man library-name

To access man pages for version 4.2 of the C++ libraries, type:

example% man -s 3CC4 library-name

You can also access the man pages by pointing your browser to:


12.2.3 Default C++ Libraries

Some of the C++ libraries are linked by default by the CC driver, while others need to be linked explicitly. In the standard mode, the following libraries are linked by default by the CC driver:

-lCstd -lCrun -lm -lc

In compatibility mode (-compat), the following libraries are linked by default:

-lC -lm -lc

See A.2.49 -library=l[,l...] for more information.