C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Using the Standard C++ Library
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
5-12
Compiling and Linking in the OSS Environment
Compiling and Linking in the OSS
Environment
In addition to the C++ compiler pragmas recognized as command-line flags as
described in Section 13, Compiler Pragmas, the OSS c89 command has a
-Wcplusplus flag that affects both compilation and linking. This flag:
Defines the __CPLUSPLUS feature-test macro to modify C header files for C++.
Causes all specified files with names suffixed by .c to be compiled as C++ files.
If a linker is also involved or in other words if -c flag is not used, using the
-Wcplusplus flag causes the standard C++ libraries to be linked.
If the -Wcplusplus flag is not specified and none of the files operated upon by c89
has a suffix of .C, .cpp, .cc, or .cxx, c89 compiles the source files only as
C files; if the -c flag is also omitted, c89 only links the C standard library.
Pragmas for the Standard C++ Library
You need to use the MAPINCLUDE and CPATHEQ pragmas to map UNIX or OSS
pathnames to Guardian file names. HP provides a CPATHEQ file for this purpose; the
file is named SLMAP for the Standard C++ Library. Like any CPATHEQ file, the SLMAP
file maps OSS directory and file names to the Guardian namespace
($volume.subvolume). Similarly, there is a TLHMAP file for mapping names in
Tools.h++ version 7.
The contents of a CPATHEQ file such as the SLMAP file:
#ifndef __SLMAP
#define __SLMAP
#pragma mapinclude "rw/math.h" = "mathh"
#pragma mapinclude "rw/random.h" = "randomh"
#pragma mapinclude "rw/stddefs.h" = "stddefsh"
#pragma mapinclude "rw/stdgen.h" = "stdgenh"
#pragma mapinclude file "algorithm.cc" = "algoricc"
#pragma mapinclude file "bitset.cc" = "bitsetcc"
#pragma mapinclude file "complex.cc" = "complecc"
#pragma mapinclude file "deque.cc" = "dequecc"
#pragma mapinclude file "iterator.cc" = "iteratcc"
#pragma mapinclude file "list.cc" = "listcc"
#pragma mapinclude file "string.cc" = "stringcc"
SIEVEC Tutorial Example Source File
SPELLC Tutorial Example Source File
TELEC Tutorial Example Source File
WIDWORKC Tutorial Example Source File
Table 5-4. VERSION2 Standard C++ Library Example Files (page 4 of 4)
Example File Description of Contents