This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to compile a program


Hi,

Eswari Natrajan wrote:
> I want to know what extension is use to save
> gfortran whether .f90 or .f and also how to compile
> program which is saved as filename.f?

gfortran supports both .f and .f90, but they mean something different.

If a file has the ".f" extension, gfortran assumes that the file is a
fixed-form source code, known from FORTRAN 77. For ".f90" (and ".f95"
and ".f03") it assumes free-form source code, which was introduced first
with Fortran 95.

If you have a free-form file which uses nonetheless ".f", one can use
"-ffree-form" to force the free-form mode.

And for completeness, if a file has the extensions ".F" or ".F90", the
file is run through CPP (the C preprocessor) before it is compiled.

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]