Sun Studio 12: C++ User's Guide

A.2.149.1 Examples

For minimal compilation to meet the C application binary interface (that is, a C++ program with only C support required), use:


example% CC– xnolib test.cc– lc

To link libm statically into a single-threaded application with the generic architecture instruction set, use:


example% CC -xnolib test.cc -lCstd -lCrun -Bstatic -lm -Bdynamic -lc

example% CC -compat -xnolib test.cc -lC -Bstatic -lm -Bdynamic -lc

Interactions

Some static system libraries, such as libm.a and libc.a, are not available when linking with -xarch=v9, -xarch=v9a or -xarch=v9b.

If you specify– xnolib, you must manually link all required system support libraries in the given order. You must link the system support libraries last.

If -xnolib is specified, -library is ignored.

Warnings

Many C++ language features require the use of libC (compatibility mode) or libCrun (standard mode).

This set of system support libraries is not stable and might change from release to release.

See also

–library, –staticlib, –l