I'm new to FORTRAN, and getting this error #6404.
my_file.f(11): error #6404: This name does not have a type, and must have an explicit type.
[POTENCIAL] d=POTENCIAL(1.0,1.0,1.0,1.0,1.4,1.4)
This is with the ifort compiler, and I hope it is not a compiler bug.
Any ideas where I'm wrong?
program iiuu
implicit none
REAL*8 d
d=POTENCIAL(1.0,1.0,1.0,1.0,1.4,1.4)
write(*,*) 'potential=', d
END program iiuu
FUNCTION POTENCIAL(R1,R2,R3,R4,R5,R6)
REAL*8 R1,R2,R3,R4,R5,R6,V2,V3,V4
DIMENSION R(6)
R(1)=R1
R(2)=R2
R(3)=R3
R(4)=R4
R(5)=R5
R(6)=R6
V2=V2BODY(R)
V3=V3BODY(R)
V4=V4BODY(R)
POTENCIAL=V2+V3+V4+VADD(R)
RETURN
END
FUNCTION V2BODY(R)
.....
.....
No, it is not a compiler bug. Here's an edit of your code which has at least a chance of compiling:
program iiuu
implicit none
REAL*8 d
d=POTENCIAL(1.0d0,1.0d0,1.0d0,1.0d0,1.4d0,1.4d0)
write(*,*) 'potential=', d
contains
real*8 FUNCTION POTENCIAL(R1,R2,R3,R4,R5,R6)
REAL*8 R1,R2,R3,R4,R5,R6,V2,V3,V4
real*8, DIMENSION(6) :: R
R(1)=R1
R(2)=R2
R(3)=R3
R(4)=R4
R(5)=R5
R(6)=R6
V2=V2BODY(R)
V3=V3BODY(R)
V4=V4BODY(R)
POTENCIAL=V2+V3+V4+VADD(R)
END function potencial
END program iiuu
potencial
function did not have a return type (which is the original error message you came across)return
statement was not necessary)modules
and use
them, or use contains
statement, like in the example above1.0
is single-precision. Use 1.d0
to tell the compiler it's a double precision numberpotencial
function?