Reputation: 1750
I am trying to compile a package written mainly in F90 that looks like this:
subroutine soil_default_fill(cgrid,ifm,ipy)
implicit none
!----- Arguments -----------------------------------------------------------------------!
type(edtype) , target :: cgrid
integer , intent(in) :: ifm
integer , intent(in) :: ipy
!----- Local variables -----------------------------------------------------------------!
STUFF
return
end subroutine soil_default_fill
!==========================================================================================!
subroutine set_site_defprops()
implicit none
!----- Local variables -----------------------------------------------------------------!
type(edtype) , pointer :: cgrid
integer :: ifm
integer :: ipy
STUFF
call soil_default_fill(cgrid,ifm,ipy)
STUFF
return
end subroutine set_site_defprops
!==========================================================================================!
When I try to compile I get the following error:
mpif90 -c -DUSE_INTERF=1 -DUSENC=0 -DMAC_OS_X -DUSE_HDF5=1 -DUSE_COLLECTIVE_MPIO=0 -DUSE_MPIWTIME=0 -O3 -ffree-line-length-none -fno-whole-file -I/Users/manfredo/Desktop/ED2/ED/src/include -I/usr/hdf5/include -DRAMS_MPI ed_init.F90
ed_init.F90:131.31:
call soil_default_fill(cgrid,ifm,ipy)
1
Error: Explicit interface required for 'soil_default_fill' at (1): target argument
make[1]: *** [ed_init.o] Error 1
make: *** [all] Error 2
I already tried to include the subroutine in an interface or in a module but it didn't worked (as I said I am new to Fortran so it is likely that I made some mistakes).
Thanks for help
Upvotes: 0
Views: 3428
Reputation: 153
It's a very simple answer but, Did you set up your module file like this example?
!----------------------------------------------------------!
module "Your Name here (without commas)"
use a_module !!! if you need one, in the other case delete it
use b_module !!! if you need another one, in the other case delete it
implicit none
public :: set_site_defprops !!! put a comment here if you want
public :: soil_default_fill !!! put a comment here if you want
contains
subroutine soil_default_fill(cgrid,ifm,ipy)
implicit none
!----- Arguments ----------------------------------------------------------!
type(edtype) , target :: cgrid
integer , intent(in) :: ifm
integer , intent(in) :: ipy
!----- Local variables ----------------------------------------------------!
STUFF
return
end subroutine soil_default_fill
!==============================================================================!
subroutine set_site_defprops()
implicit none
!----- Local variables -------------------------------------------------!
type(edtype) , pointer :: cgrid
integer :: ifm
integer :: ipy
STUFF
call soil_default_fill(cgrid,ifm,ipy)
STUFF
return
end subroutine set_site_defprops
!==============================================================================!
end module "Your Name here (without commas)"
Upvotes: 1