HP C/aC++ for PA-RISC Software manual Files on the aCC Command Line, ++ Source File .C file

Models: C/aC++ for PA-RISC Software

1 230
Download 230 pages 50.97 Kb
Page 25
Image 25

This command compiles and optimizes prog.C, gives verbose progress reports, and creates an executable file a.out.

Compiling and Creating a Shared Library

aCC +z -c prog.C

aCC -b -o mylib.sl prog.o

The first line compiles prog.C, creates the object file prog.o, and puts the position-independent code (PIC) into the object file. The second line creates the shared library mylib.sl, and puts the executable code into the shared library.

Files on the aCC Command Line

Files containing source or object code to be compiled or linked by HP aC++ can be any of these files:

A C++ Source File (.C file)

Preprocessed Source Files (.i Files)

Assembly Language Source Files (.s Files)

Object Files (.o Files)

Library Files (.a and .so Files)

“Configuration Files (.conf Files)” (page 26)

Unless you use the -ooption to specify otherwise, all files that the aCC compiling system generates are put in the working directory, even if the source files are from other directories.

C++ Source File (.C file)

You must name the HP aC++ source files with extensions beginning with either .c or .C, possibly followed by additional characters. If you compile only, for example by using -c, each C++ source file produces an object file with the same file name prefix as the source file and a .o file name suffix.

However, if you compile and link a single source file into an executable program in one step, the

.o file is automatically deleted, unless -gis used without +noobjdebug.

NOTE: HP recommends that your source files have .c or .C extensions only, without any additional characters. While extensions other these are permitted for portability from other systems, they may not be supported by HP tools and environments.

Preprocessed Source Files (.i Files)

Files with .i extensions are assumed to be preprocessor output files. These files are processed in the same way as .c or .C files, except that the preprocessor is not run on the .i file before the file is compiled.

Use the -Por the -Ecompiler option to preprocess a C++ source file without compiling it.

Assembly Language Source Files (.s Files)

Files with names ending in .s are assumed to be assembly source files. The compiler invokes the assembler through cc to create .o files from these.

Use the -Soption to compile a C++ source file to assembly code and put the assembly code into a .s file.

Files on the aCC Command Line 25

Page 25
Image 25
HP C/aC++ for PA-RISC Software Files on the aCC Command Line, ++ Source File .C file, Preprocessed Source Files .i Files