我正在尝试编译一个主要在F90中编写的包,如下所示:
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
!==========================================================================================!
当我尝试编译时,我收到以下错误:
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
我已经尝试将子例程包含在接口或模块中,但它没有用(因为我说我是Fortran的新手所以很可能是我犯了一些错误)。
感谢您的帮助
答案 0 :(得分:1)
这是一个非常简单的答案,但是, 您是否像这个示例一样设置了模块文件?
!----------------------------------------------------------!
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)"