search    
HP aC++ Online Programmer's Guide
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++).

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. It compiles C++ source statements. Preprocessing is incorporated into the compiler.
    Location: /opt/aCC/lbin/ctcom

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:

Header files for these libraries are located at /opt/aCC/include and /opt/aCC/include_std.

  • Standard C++ Library
    • /usr/lib/libstd.sl and libstd_v2.sl - 32-bit shared version
    • /usr/lib/libstd.a and libstd_v2.a - 32-bit archive version
    • /usr/lib/pa20_64/libstd.sl and libstd_v2.sl - 64-bit shared version
    • /usr/lib/pa20_64/libstd.a and libstd_v2.a - 64-bit archive version

  • HP aC++ Run-time Support Library
    • /usr/lib/libCsup.sl and libsCsup_v2.sl - 32-bit shared version
    • /usr/lib/libCsup.a and libsCsup_v2.a - 32-bit archive version
    • /usr/lib/pa20_64/libCsup.sl and libsCsup_v2.sl - 64-bit shared version
    • /usr/lib/pa20_64/libCsup.a and libsCsup_v2.a - 64-bit archive version

  • IOStream Library
    • /usr/lib/libstream.sl - 32-bit shared version
    • /usr/lib/libstream.a - 32-bit archive version
    • /usr/lib/pa20_64/libstream.sl - 64-bit shared version
    • /usr/lib/pa20_64/libstream.a - 64-bit archive version

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.