Fortran 95

GFortran
GFortran Getting Started
GFortran Usage

Fortran: Fortran 95: Unterprogramme
Fortran: Fortran 95: Datentypen
Fortran/Fortran examples (en)

RANDOM_NUMBER — Pseudo-random number
RAND — Real pseudo-random number

How can gfortran tell if I am compiling f90 or f95 code?

FAQ

Question

$ make
[FC] src/main.f90
make: gfortran-4.7: Command not found
Makefile.inc:37: recipe for target 'obj/main.o' failed
make: *** [obj/main.o] Error 127

Answer

$ sudo apt-get install gfortran
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  gfortran-5 libgfortran-5-dev
Suggested packages:
  gfortran-multilib gfortran-doc gfortran-5-multilib gfortran-5-doc libgfortran3-dbg
The following NEW packages will be installed:
  gfortran gfortran-5 libgfortran-5-dev
[...]

$ vi Makefile
Change gfortran-4.7 to gfortran

$ make
[FC] src/main.f90
[FC] src/pi.f90
[LD] pi

Question

$ make
[MKDIR] obj/hello/./
[FC] src/hello.f

[...]

Error: Non-numeric character in statement label at (1)
src/hello.f:15:3:

   end 
   1
Error: Unclassifiable statement at (1)
f951: Error: Unexpected end of file in ‘src/hello.f’
Makefile.inc:50: recipe for target 'obj/hello/hello.o' failed
make: *** [obj/hello/hello.o] Error 1

Answer

Getting started with gfortran
Options controlling Fortran dialect

-ffree-form
-ffixed-form
Specify the layout used by the source file. The free form layout was introduced in Fortran 90. Fixed form was traditionally used in older Fortran programs. When neither option is specified, the source form is determined by the file extension.

hello_FFLAGS  = -ffree-form

Leave a Reply

Your email address will not be published. Required fields are marked *