This section describes how to use Unix compilers to compile programs that use Rogue Wave's Standard C++ Library.
To use the Standard C++ Library library in your own program:
Add the directory containing the Standard C++ Library header files to your include list.
Link to the appropriate Standard C++ Library.
For instance, to build a program called myapp you might use the following command line (all on one line):
CC -Irwav/workspaces/SOLARIS251/SUNPRO420/11s myapp.cpp rwav/workspaces/SOLARIS251/SUNPRO420/11s/lib/libstd11s.a -o myapp
The example assumes the library was exported to the rwav/workspaces/SOLARIS251/SUNPRO420/11s directory.
If you linked to a static Standard C++ Library library, you are ready to run the resulting program.
If you linked to a shared Standard C++ Library library, before running the resulting program, be sure that the library location is available in the environmental variable that your operating system uses to describe the possible locations of shared libraries. For many operating systems, this environmental variable is LD_LIBRARY_PATH. Some operating systems use a different name; be sure to use the one appropriate to your operating system.
This step is recommended for all shared Unix Standard C++ Library libraries, and required for some platforms.
You may set the library path variable from your shell or by including it in your rc or profile script.
For example, in a Korn or Bourne shell, if your library is installed in the /rwav/workspaces/SOLARIS251/SUNPRO420/11s/lib directory, use the following command (all on one line):
export LD_LIBRARY_PATH=rwav/workspaces/SOLARIS251/SUNPRO420 /11s/lib:$LD_LIBRARY_PATH
If you are running in other than a Bourne or Korn shell, the command is:
setenv LD_LIBRARY_PATH rwav/workspaces/SOLARIS251/SUNPRO420 /11s/lib:$LD_LIBRARY_PATH
For more information on compiling using shared libraries, review the Standard C++ Library readme files located in <rw_root>/parts/std<ver>u/docs.
To use the multithread-safe version of the library, you need to:
Add the Standard C++ Library include directory to your list of include directories.
Add the import library name to your list of link objects.
Define the macro RWSTD_MULTI_THREAD. This will communicate to the Standard C++ Library header files your intention to use a multithread-safe version of the library.
For example, to build a program called test.exe as a multithread-safe library, you could use the following command (all on one line):
CC -Imyroot/workspaces/SOLARIS251/SUNPRO420/12s/include test.cpp -DRWSTD_MULTI_THREAD myroot/workspaces/SOLARIS251/SUNPRO420/12s/libstd12s.a
©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.