search    
Hewlett-Packard
Getting Started with HP aC++
The HP aC++ compiler supports the ISO/IEC 14882 Standard for the C++ Programming Language (the international standard for C++). The HP ANSI C compiler supports ANSI programming language C standard ISO 9899:1990.

This section discusses the following topics:

Major Components of the Compilation System
The HP aC++ compiling system consists of the following components:
  • aCC:
    aCC is the driver. This is the only supported interface to HP aC++ and to the linker for HP aC++ object files.
    Location: /opt/aCC/bin/aCC

  • ctcom:
    ctcom is the compiler for version A.05.60. It compiles C++ source statements. Preprocessing is incorporated into the compiler.
    Location: /opt/aCC/lbin/ctcom

  • ecom:
    ecom is the compiler for version A.06.00. It compiles C++ source statements. Preprocessing is incorporated into the compiler.
    Location: /opt/aCC/lbin/ecom

The other HP aC++ executable files are:
  • c++filt:
    c++filt is the name demangler. It implements the name demangling algorithm which encodes function name, class name, parameter number and name.
    Location: /opt/aCC/bin/c++filt

  • ld:
    The linker links executables and builds shared libraries.
    Location: /usr/ccs/bin/ld

HP aC++ Run-time Libraries and Header Files:
  • Standard C++ Library
    • /usr/lib/hpux32/libstd.so - 32-bit shared version
    • /usr/lib/hpux32/libstd.a - 32-bit archive version
    • /usr/lib/hpux64/libstd.so - 64-bit shared version
    • /usr/lib/hpux64/libstd.a - 64-bit archive version

  • HP aC++ Run-time Support Library
    • /usr/lib/hpux##/libCsup.so
    • /usr/lib/hpux##/libstd.so and libstd_v2.so
    • /usr/lib/hpux##/libstd_v2.so and librwtool_v2.so
    • /usr/lib/hpux##/libstream.so
    • Libraries in /usr/include/hpux##
    (where ## is 32 or 64 - provided as part of the HP-UX core system)

  • IOStream Library
    • /usr/lib/hpux32/libstream.so - 32-bit shared version
    • /usr/lib/hpux32/libstream.a - 32-bit archive version
    • /usr/lib/hpux64/libstream.so - 64-bit shared version
    • /usr/lib/hpux64/libstream.a - 64-bit archive version


Note: Some of the following runtime libraries are provided in both shared and archive versions. Header files for these libraries are located at /opt/aCC/include and .
Using the aCC Command
To invoke the HP aC++ compiling system, use the aCC command at the shell prompt. The aCC command invokes a driver program that runs the compiling system according to the filenames and command line options that you specify.

Example:
$ aCC myprog.c

Compiling and Executing a Simple Program
Compiling a Simple Program
The best way to get started with HP aC++ is to write, compile, and execute a simple program, like the following one:
#include <iostream.h>
int main()
{
      int x,y;
      cout << "Enter an integer: ";
      cin >> x;
      y = x * 2;
      cout << "\n" << y <<" is twice " << x <<".\n";
}
If this program is in the file getting_started.C, compiling and linking the program with the aCC command produces an executable file named a.out:

$ aCC getting_started.C

Executing the Program
To run this executable file, just enter the name of the file.

The following summarizes this process with the file named getting_started.C:

$ a.out 

  Enter an integer: 7

  14 is twice 7.
Debugging Programs
You can use the HP WDB Debugger to debug your C++ programs. To do so, first compile your program with either the -g, the -g0, or the -g1 option.

Examples:

  1. The -g0 option enables generation of debug information:
    $ aCC -g0 program.C

  2. The gdb command runs the HP WDB Debugger:
    $ gdb a.out

Accessing Online Example Source Files
Online example source files are located in the directory, /opt/aCC/contrib/Examples/RogueWave. These include examples for the Standard C++ Library and for the Tools.h++ Library.