Sprock
Sprock

Reputation: 33

Error message when trying to create a module in fortran 90

I am trying to create a module for a fortran 90 program. The file is called epath.f90. When I try to create the file epath.mod by running an object-only compile on the file by way of the commad f95 -c epath.f90 it gives me the following error message:

epath.f90:1:

MODULE euler-path
1
Error: Unclassifiable statement at (1)
epath.f90:8.3:

END MODULE euler-path
   1
Error: Expecting END PROGRAM statement at (1)
Error: Unexpected end of file in 'epath.f90'

The code for epath.f90 is:

MODULE euler-path

INTEGER, PARAMETER :: NSTEPS=10
REAL, PARAMETER :: A=0.0, B=1.0, YSTART=0.0
REAL, DIMENSION(0:NSTEPS) :: x,y

END MODULE euler-path

I took the same steps for another module and it worked fine. Any help is appreciated.

Upvotes: 1

Views: 1320

Answers (1)

Jonathan Dursi
Jonathan Dursi

Reputation: 50967

In Fortran, names - module names, variable names, etc - have to start with a letter and contain only letters, digits, or underscores. (Fortran in particular forbids using special characters like operators, eg, -/+/*/(/) in names because it's historically taken a very cavalier approach to the use of spaces, or for that matter explicitly defined variable names, which would make it very difficult to distinguish between a-b as a name and the expression a - b.) See, eg, section 3.2.2 ("Names") of the recent Fortran standard.

So euler_path is ok, euler_path123 is ok, but euler-path isn't.

Upvotes: 2

Related Questions