Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29253 Discussions

error #6404: This name does not have a type, and must have an explicit type.

pavigo
Beginner
9,116 Views
Hi, I'm new in 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)
Any ideas where I'm wrong?
Thank you
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
V3=V3BODY
V4=V4BODY
POTENCIAL=V2+V3+V4+VADD
RETURN
END
FUNCTION V2BODY
.....
.....
0 Kudos
4 Replies
mecej4
Honored Contributor III
9,117 Views
The message from the compiler is crystal clear; if you do not understand it, perhaps a session with a Fortran textbook/manual would be beneficial.

program iiuu
implicit none
REAL*8 d, POTENCIAL
d=POTENCIAL(1.0d0,1.0d0,1.0d0,1.0d0,1.4d0,1.4d0) ! Thanks, TimP.
write(*,*) 'potential=', d
END program iiuu
REAL*8 FUNCTION POTENCIAL(R1,R2,R3,R4,R5,R6)
implicit none
REAL*8 R1,R2,R3,R4,R5,R6,V2,V3,V4, R
REAL*8
V2BODY,V3BODY,V4BODY,VADD
DIMENSION R(6)
R(1)=R1
R(2)=R2
R(3)=R3
R(4)=R4
R(5)=R5
R(6)=R6
V2=V2BODY
V3=V3BODY
V4=V4BODY
POTENCIAL=V2+V3+V4+VADD
RETURN
END

REAL*8 FUNCTION V2BODY
....
0 Kudos
TimP
Honored Contributor III
9,117 Views
There's still a discrepancy between the data types of the constants passed to the function and the declarations internal to the function.
Perhaps OP meant to use an internal or module function, where the data types get fixed up by the compiler.
0 Kudos
Steven_L_Intel1
Employee
9,117 Views
"fixed up"? Not really. As an extension, the compiler will convert the KIND of constant arguments when it can see the interface of the called routine, but that's non-standard. As noted, the function needs to be declared correctly and the correct argument types/kinds passed.
0 Kudos
pavigo
Beginner
9,117 Views
Thank you all, very fast respond!!! I'm impressed.
I got it to work.

Just changed it to correct data and added variable for function returned.
The rest still the same.


program iiuu
IMPLICIT none
REAL*8 d, POTENCIAL
d=POTENCIAL(1.0d0,1.0d0,1.0d0,1.0d0,1.4d0,1.4d0)
write(*,*) 'potential=', d
END program iiuu
FUNCTION POTENCIAL(R1,R2,R3,R4,R5,R6)
IMPLICIT REAL*8(A-H,O-Z)
DIMENSION R(6)
R(1)=R1
R(2)=R2
......
......
0 Kudos
Reply