Compile and link simple programs
We strongly recommend use of D0 utilities for compiling and linking. This is especially important for programs using D0 libraries, and requiring libtest/nolibtest functionality.
Most compilers make compile and load steps, unless instructed otherwise. Necessary object libraries are passed as the xxx.a files to the compiler.
The resulting linked program is by default stored in a file a.out.
Directive -o filename will send the resulting program to the
requested file.
The following compilers are available on Silicon Graphics systems (on other
systems the compiler names may vary, consult the man pages):
- f77 - Fortran 77 compiler. It expects files to be compiled to
have a file extension .f (for example myprog.f).
Its most frequently used switches
are:
- -c
Suppress the loading phase of the compilation and force an object
file to be produced even if only one program is compiled.
- -static
Cause all local variables to be statically allocated. Statically
allocated local variables are initialized to zero and exist for the
life of the program. This option is usually needed for programs
ported from older systems (e.g. VMS) where all variables are
statically allocated.
Example:
f77 -c func1.f
f77 -o myprog.x myprog.f func1.o mylib.a
- cc - C compiler. It expects files to be compiled to have a file extension .c (fro example myprog.c). This compiler can be used as well to compile
programs/subroutines written in Fortran.Its most frequently used
switches are:
- -c
Suppress the loading phase of the compilation and force an object
file to be produced even if only one program is compiled.
- -Idir
`#include' files whose names do not begin with `/' are always
sought first in the directory of the file argument, then in
directories specified in -I options, and finally in the standard
directory (/usr/include).
Example:
cc -c func1.c
cc -o myprog.x myprog.cc fync1.o mylib.a
- CC - CC compiler.
CC (capital CC) translates C++ source code to
C source code. Its normal
operation is then to invoke the C compiler cc(1) to generate an object
file.
CC takes arguments ending in .c, .C, .c++, or .cxx to be C++ source
programs.
Links to other D0 pages
Last updated September 10, 1995.
A.P.