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

24,117

Solution 1

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
  1. Your potencial function did not have a return type (which is the original error message you came across)
  2. It did not return anything (return statement was not necessary)
  3. At the call point compiler had no idea where to look for the function. Either package your functions into modules and use them, or use contains statement, like in the example above
  4. 1.0 is single-precision. Use 1.d0 to tell the compiler it's a double precision number
  5. Why on earth do you send six numbers instead of having an array as an argument of the potencial function?

Solution 2

I got it to work. Just changed it to correct data type representation. 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
......
......
Share:
24,117
Pavigo
Author by

Pavigo

Updated on July 05, 2022

Comments

  • Pavigo
    Pavigo almost 2 years

    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)
      .....
      .....
    
  • Pavigo
    Pavigo over 12 years
    Thank you, I got it to work. Just changed it to correct data type representation. The rest still the same.
  • Pavigo
    Pavigo over 12 years
    I'd like to raise yours rating, but cant do it - haven't enough posts yet.
  • xpda
    xpda over 12 years
    @user1092021 - If it answers your question you can click on the checkmark to raise the rating. That's considered appropriate.
  • Pavigo
    Pavigo over 6 years
    Answer to #5. Actually I don't know who did it 20 years ago, I just had to fix it for my wife's research in a chemistry. it's contains 40 pages of code, and rewriting this code isn't cost effective.