DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Getting Started

Compiling and Linking with C++ Standard Components

The header files, template definition files and object library archives for C++ Standard Components are installed in the normal system directories for such files. Thus, to compile and link with C++ Standard Components, it is only necessary to specify the appropriate Standard Components archives to the CC(1C++) command. There are three archives:


lib++.a
all Standard Components except fs and G2++

libfs.a
fs component

lib2g++.a
G2++ component

For example, to compile and link an application that only uses the String component:

   $ CC string_user.C -l++
To compile and link the same application for fs(3C++) analysis:
   $ CC -f string_user.C -lfs -l++
(The -f option instructs the compilation system to prepare the source for fs.)

Several of the Standard Components use templates. Depending on your use of these components, you may need to specify an additional compiler option to guide template instantiation. See the chapter Instantiating C++ Templates in the book Programming in Standard C and C++ for details. One choice that will work is to use automatic template instantiation. In this case, the command to compile and link an application that uses both the String and Map components would be:

   $ CC string_and_map_user.C -l++
Of course, additional CC(1C++) options can be used as desired.
Next topic: Thread Safety
Previous topic: Component names and component documentation

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004