Fortran compile error

565 views Asked by At

I tried to compile a fortran program for soil-plant-atmosphere model, but I can't compile it under Ubuntu, it keeps giving me the error message like this:

f77 -c -o o/cupin2.o  src/cupin2.f
src/cupin2.f: In subroutine `reflt':
src/cupin2.f:742: 
         dimension tairgl,eairgl,windgl,psisgl,hsoil,ecpy,hcpy
                         ^
Invalid form for DIMENSION statement at (^)
make: *** 
[o/cupin2.o] Error 1

Can anyone help me with this. Thanks. Complete source code is here:Source Code

2

There are 2 answers

0
AudioBubble On BEST ANSWER

The DIMENSION statement is used to dimension arrays - so you have to specify the array dimensions. For example:

dimension tairgl(100),eairgl(20,50), ...

You don't actually need the DIMENSION statement, however, you could also say something like:

real tairgl(100)
integer eairgl(20,50)
0
peter.murray.rust On

You don't say whether this is your edit or whether someone else has written the code. The DIMENSION statement is described in: http://en.wikipedia.org/wiki/Fortran_language_features for example:

INTEGER, DIMENSION(0:100, -50:50) :: map

It expects array bounds after it. It's rather outdated and normally replaced by the type (e.g. REAL and the array bounds).

If you have inherited the code (and if it's got a long history) it's possible it has some syntax which is now non-standard but still compiles on some machines. If you are actively editing the code you will need to learn some FORTRAN.

UPDATE from a previous question the OP appears to have deleted the array bounds from a syntactically correct dimension statement.