Next 20.B: Programming Courtesy Up 20: Running Fortran Prev 20: Running Fortran Contents


Specialized

§ 20.A: Compiling Fortran


Once you have gone through the trouble of writing your program, you deserve the opportunity to run it. The most popular Fortran compiler is f77 (Fortran 77), although the f90 compiler may serve you just as well and contain f77 as a subset. A basic compilation is

Here area.f is the name of a file containing Fortran source code for the program you wish to compile. If your program does not contain serious errors, this command produces a file a.out.

If your program is complete (and not just a subroutine, for example), a.out will be executable version of area.f. If your program is not complete, a.out will contain an object code version of it.To run the executeable, just enter a.out followed by the return key

The name a.out is conventional, but not terribly descriptive. To make things clearer, you can give the -o option (for "object") to the compile command and thereby give the compiled code a new name: