Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

module interface problem

Status
Not open for further replies.

Pfor

Technical User
Aug 11, 2010
22
IT
hallo all,
I have been given a code to modify (old fortran 77 in fixed format)
so I changed it introducing modules (instead of "common" type sintax).

There is a compilation problem of this kind:
This name does not have a type, and must have an explicit type. [XMELE]
XMELE=0.

Since the Xmele is defined in module parametri (which is used in the subroutine using
xmele) it is puzzling why the
compiler (ifort and gfortran) tells me that it has not been declared.

I show you part of the code (I cancel all the other things which do not appear problematic):
----------------------------------------------------------------
module parametri
implicit none
public
real (kind =8) :: XMELE

interface INDINT
module procedure INDINT
end interface

SUBROUTINE INDINT(xmele)
implicit none
XMELE=0.
end subroutine indint

end module parametri

program Zeta
use parametri
implicit none
call INDINT(XMELE)
end program Zeta
----------------------------------------------------------------------------
thanks,
ciao
Paolo



 
xmele in the
SUBROUTINE INDINT(xmele)
is an argument of the subroutine which is not the same as the variable
XMELE declared in the module.
try this
Code:
module parametri
  implicit none 
  public                        
  real (kind =8) :: XMELE    

  interface INDINT  
    module procedure INDINT
  end interface

contains 
 SUBROUTINE INDINT(XMELE)
   implicit none
   real (kind =8) :: XMELE
   XMELE=0.      
 end subroutine indint
end module parametri

program Zeta
  use parametri
  implicit none
  XMELE=5
  write(*,*) XMELE
  call INDINT(XMELE)
  write(*,*) XMELE
end program Zeta
or this
Code:
module parametri
  implicit none 
  public                        
  real (kind =8) :: XMELE    

  interface INDINT  
    module procedure INDINT
  end interface

contains 
 SUBROUTINE INDINT
   implicit none
   XMELE=0.      
 end subroutine indint
end module parametri

program Zeta
  use parametri
  implicit none
  XMELE=5
  write(*,*) XMELE
  call INDINT
  write(*,*) XMELE
end program Zeta
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top