A Mug's Guide to Running Fortran Programs

P. A. Robinson

dividing line

This is a brief guide that outlines how to write, compile and run a Fortran program under UNIX.


Write a Fortran 77 code and place it in a file with the suffix .f

The command f77 will compile the code. A workable syntax is f77 -o fileout.e filein.f, which puts the executable version of the Fortran from "filein.f" into "fileout.e". The suffix ".e" is not necessary, but is useful in distinguishing executable files from others. A better syntax is f77 -O4 -Bstatic -o fileout.e filein.f, which optimizes the executable for faster running.

If your code uses NCARGraphics routines you should substitute the command ncargf77 for f77 above.

Type the name of your executable file and it will run.

The author thanks G. Geers for proofreading this guide.



University of Sydney | Faculty of Science | School of Physics | Science Foundation | Back to Top