0

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

r1cebank
  • 345
  • 1
  • 3
  • 12
  • You'll get better answers if you at least post the lines that generate the error. Most people aren't going to go downloading that whole source code bundle just to answer your question. – JSBձոգչ Dec 22 '09 at 18:47
  • 2
    You have asked a very similar question in http://stackoverflow.com/questions/1947183/intel-visual-fortran-compiling-error where the dimension statement DOES have array bounds. This suggests that you have edited the code. If you don't understand a language, making random chenges is unlikely to fix bugs. – peter.murray.rust Dec 22 '09 at 19:09

2 Answers2

2

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)
1

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.

peter.murray.rust
  • 37,407
  • 44
  • 153
  • 217