如何调试Fortran 90编译错误"(1)处的通用'foo'没有特定的子程序"?

Jak*_*ski 3 fortran compiler-errors gfortran fortran90 fortran-iso-c-binding

我正在尝试使用iso_c_bindings模块将Fortran 2003绑定写入CUFFT库,但我遇到cufftPlanMany子程序问题(类似于sfftw_plan_many_dftFFTW库).

绑定本身如下所示:


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! cufftResult cufftPlanMany(cufftHandle *plan, int rank, int *n,
!                           int *inembed, int istride, int idist,
!                           int *onembed, int ostride, int odist,
!                           cufftType type, int batch)
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

interface cufftPlanMany
subroutine cufftPlanMany(plan, rank, n, &
                         inembed, istride, idist, &
                         onembed, ostride, odist, &
                         type, batch) &
& bind(C,name='cufftPlanMany')
use iso_c_binding
integer(c_int):: plan
integer(c_int),value:: rank, type, batch
integer(c_int):: n(*)
integer(c_int),value:: istride, idist, ostride, odist
integer(c_int):: inembed(*), onembed(*)
end subroutine cufftPlanMany
end interface cufftPlanMany
Run Code Online (Sandbox Code Playgroud)

调用部分看起来像这样:


  integer(c_int):: plan
  integer(c_int):: batch
  integer(c_size_t):: size

! ...

    call cufftPlanMany(plan, 1, size,&
                       0, 1, size,&
                       0, 1, size,&
                       CUFFT_C2C, batch)
Run Code Online (Sandbox Code Playgroud)

不幸的是,试图编译这个结果

错误:(1)的通用'cufftplanmany'没有特定的子程序

编译错误.试图用变量代替常量也没有帮助.你可以帮忙调试吗?

使用的编译器是gfortran:GNU Fortran(Gentoo 4.4.5 p1.2,pie-0.4.5)4.4.5

Vla*_*r F 8

我认为伪参数的类型不符合调用中的实际参数.当它们应该是int*时,为什么要将n,inembed,onembed声明为数组,例如.刚从fortran传来整数?另外,确定你可以互换int和size_t吗?我担心你的系统上的size_t可能是64位和gcc中的32位.