HP C A.06.05 Reference Manual
Compiling and Running HP C Programs
Compiling HP C Programs
Chapter 9 209
Files with names ending in .i are assumed to be preprocessor output files. Files ending in .i
are processed the same as .c files, except that the preprocessor is not run on the .i file before
the file is compiled.
Files with names ending in .s are assumed to be assembly source files; the compiler invokes
the assembler to produce .o files from these.
Files with .o extensions are assumed to be relocatable object files that are included in the
linking. All other files are passed directly to the linker by the compiler.
Specifying Options to the cc Command
Each compiler option has the following format:
-optionname
[
optionarg
]
where:
optionname
is the name of a standard compiler option.
optionarg
is the argument to
optionname
.
The optional argument -- delimits the end of options. Any following arguments are treated as
operands (typically input filenames) even if they begin with the minus (-) character.
An Example of Using a Compiler Option
By default, the cc command names the executable file a.out. For example, given the
following command line:
cc demo.c
the executable file is named a.out.
You can use the -o option to override the default name of the executable file produced by cc.
For example, suppose my_source.c contains C source code and you want to create an
executable file name my_executable. Then you would use the following command line:
cc -o my_executable my_source.c
Concatenating Options
You can concatenate some options to the cc command under a single prefix. The longest
substring that matches an option is used. Only the last option can take an argument. You can
concatenate option arguments with their options if the resulting string does not match a
longer option.
For example, suppose you want to compile my_file.c using the -v, -g, and -DPROG=sub
compiler options. There are several ways to do this: