Types of Input Files

You can input the following types of files to the VisualAge C++ batch compilers:

C and C++ Source Files These are files containing a C or C++ source module.

To use the compiler as a C language compiler to compile a C language source file, the source file must have a .c (lowercase c) suffix, for example, mysource.c.

To use the compiler as a C++ language compiler, the source file must have a .C (uppercase C), .cc, .cpp, or .cxx suffix. To compile other files as C++ source files, use the -+ compiler option. All files specified with this option with  a suffix other than .o, .a, or .s, are compiled as C++ source files.

The compiler will also accept source files with the .i suffix. This extension designates preprocessed source files.

The compiler processes the source files in the order in which they appear. If the compiler cannot find a specified source file, it produces an error message and the compiler proceeds to the next specified file. However, the link editor will not be run and temporary object files will be removed.

Your program can consist of several source files. All of these source files can be compiled at once using only one invocation of xlC. Although more than one source file can be compiled using a single invocation of the compiler, you can specify only one set of compiler options on the command line per invocation. Each distinct set of command-line compiler options that you want to specify requires a separate invocation.

By default, the xlC command preprocesses and compiles all the specified source files. Although you will usually want to use this default, you can use the xlC command to preprocess the source file without compiling by specifying either the -E or the -P option. If you specify the -P option, a preprocessed source file, file_name.i, is created and processing ends.

The -E option preprocesses the source file, writes to standard output, and halts processing without generating an output file.

Preprocessed Source Files Preprocessed source files have a .i suffix, for example, file_name.i.

The xlC command sends the preprocessed source file, file_name.i, to the compiler where it is preprocessed again in the same way as a .c file. Preprocessed files are useful for checking macros and preprocessor directives.

Object Files Object files must have a .o suffix, for example, year.o.

Object files, library files, and nonstripped executable files serve as input to the linkage editor. After compilation, the linkage editor links all of the specified object files to create an executable file.

Assembler Files Assembler files must have a .s suffix, for example, check.s.

Assembler files are assembled to create an object file.

Nonstripped Executable Files Extended Common Object File Format (XCOFF) files that have not been stripped with the AIX strip command can be used as input to the compiler. See the strip command in the AIX Version 4 Commands Reference, and the description of a.out file format in the AIX Version 4 Files Reference for more information.


Types of Output Files