- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
.....
.....
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
REAL*8 V2BODY,V3BODY,V4BODY,VADD
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, RREAL*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
....
REAL*8 FUNCTION V2BODY
....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Perhaps OP meant to use an internal or module function, where the data types get fixed up by the compiler.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
......
......

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page