JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.3: C++ User's Guide     Oracle Solaris Studio 12.3 Information Library
search filter icon
search icon

Document Information

Preface

Part I C++ Compiler

1.  The C++ Compiler

2.  Using the C++ Compiler

3.  Using the C++ Compiler Options

Part II Writing C++ Programs

4.  Language Extensions

5.  Program Organization

6.  Creating and Using Templates

7.  Compiling Templates

8.  Exception Handling

9.  Improving Program Performance

10.  Building Multithreaded Programs

Part III Libraries

11.  Using Libraries

11.1 C Libraries

11.2 Libraries Provided With the C++ Compiler

11.2.1 C++ Library Descriptions

11.2.2 Accessing the C++ Library Man Pages

11.2.3 Default C++ Libraries

11.3 Related Library Options

11.4 Using Class Libraries

11.4.1 iostream Library

11.4.1.1 Note About Classic iostreams and Legacy RogueWave Tools

11.4.2 Linking C++ Libraries

11.5 Statically Linking Standard Libraries

11.6 Using Shared Libraries

11.7 Replacing the C++ Standard Library

11.7.1 What Can Be Replaced

11.7.2 What Cannot Be Replaced

11.7.3 Installing the Replacement Library

11.7.4 Using the Replacement Library

11.7.5 Standard Header Implementation

11.7.5.1 Replacing Standard C++ Headers

11.7.5.2 Replacing Standard C Headers

12.  Using the C++ Standard Library

13.  Using the Classic iostream Library

14.  Building Libraries

Part IV Appendixes

A.  C++ Compiler Options

B.  Pragmas

Glossary

Index

11.3 Related Library Options

The CC driver provides several options to help you use libraries.

A library that is specified using both –library and –staticlib options will be linked statically. Some examples:

libstdcxx (distributed as part of the Oracle Solaris OS)

The following command links the classic-iostreams form of Tools.h++ version 7 and libiostream libraries dynamically.

example% CC test.cc -library=rwtools7,iostream

The following command links the libgc library statically.

example% CC test.cc -library=gc -staticlib=gc

The following command excludes the libraries libCrun and libCstd, which would otherwise be included by default.

example% CC test.cc -library=no%Crun,no%Cstd

By default, CC links various sets of system libraries depending on the command line options. If you specify -xnolib (or -nolib), CC links only those libraries that are specified explicitly with the -l option on the command line. (When -xnolib or -nolib is used, the -library option is ignored, if present.)

The –R option allows you to build dynamic library search paths into the executable file. At execution time, the runtime linker searches these paths for the shared libraries needed by the application. The CC driver passes – R<install-directory>/lib to ld by default if the compiler is installed in the standard location. You can use -norunpath to disable building the default path for shared libraries into the executable.

The linker searches /lib and /usr/lib by default. Do not specify these directories or any compiler installation directories in -L options.

Programs built for deployment should be built with -norunpath or an -R option that avoids looking in the compiler directory for libraries. See 11.6 Using Shared Libraries.