16.C: Programming Courtesy | 16: Programming | 16: Programming |
Once you have gone through the trouble of writing your Fortran program, you
probably want to have it run. The most popular Fortran compiler is
f77
(Fortran 77). The most basic use of f77
is
demonstrated as follows:
> cd ~/development/prog
> f77 area.f
area.f
is the name of the program you wish to compile.
This command produces a file called a.out
which is the
executable program. To run it, you just type a.out
and
then the return
key.
> a.out
a.out
is not a very descriptive name. Fortunately, it is possible
for the compiler to give the compiled code a new name. This is done with the
-o
flag. You use it after the compile line shown above, followed
by the name you want the executable program to have.
> f77 area.f -o it-runs
This compiles your Fortran program into an executable called
it-runs
. To run it, simply type the name of the executable.
> it-runs
For some scientific programs, an additional library of mathematical functions called LAPACK is used. For a tutorial on how to use LAPACK routines, look at the PH 465 LAPACK tutorial.
16.C: Programming Courtesy | 16: Programming | 16: Programming |