首页 > 解决方案 > 警告缺少以下符号

问题描述

我编写使用模块结构的代码。

该模块由子程序和函数组成。其中一些由主程序调用,另一些由放置在模块中的子例程调用。

这是与我的问题相关的模块的重要部分:

module de

implicit none

public :: dsftdw ...
Private :: dless ...

contains
.
.
.
subroutine dsftdw ( l, u, k, lda, a, MAAP ) 

implicit none

integer(kind =3) :: lda
integer(kind =3) :: k
integer(kind =3) :: l
integer(kind =3) :: MAAP(:)
integer(kind =3) :: u
real(kind =3) :: a(lda,*)
logical       ::       dless
integer(kind =3) :: i
integer(kind =3) :: j
integer(kind =3) :: t

i = l
j = 2 * i
t = MAAP(i)

do

if ( u < j ) then
exit
end if

if ( j < u ) then
if ( dless ( k, a(1,maap(j)), a(1,maap(j+1)) ) ) then
j = j + 1
end if
end if

if ( dless ( k, a(1,maap(j)), a(1,t)) ) then
exit
end if

MAAP(i) = MAAP(j)
i = j
j = 2 * i

end do

MAAP(i) = t

end subroutine
.
.
.
function dless ( k, p, q )

implicit none

real(kind =3) :: cmax
logical     ::         dless
integer(kind =3) :: i
integer(kind =3) k
real(kind =3) :: p(k)
real(kind =3) :: q(k)
real(kind =3) :: tol

tol = 100.0D+00 * epsilon ( tol )

do i = 1, k

cmax = max ( abs ( p(i) ), abs ( q(i) ) )

if ( abs ( p(i) - q(i) ) <= tol * cmax .or. cmax <= tol ) then
cycle
end if

if ( p(i) < q(i) ) then
dless = .true.
else
dless = .false.
end if

return

end do

dless = .false.

end function
.
.
.
end module
(MAIN PROG BLOCK)

该模块放置在与 Main 程序相同的代码中。上述子程序独立于主程序,功能只在模块子程序中使用。

当我构建此代码时,它会显示以下警告:

警告缺少以下符号

当我运行代码时,它显示了这个错误:

运行时错误:调用缺少的例程

错误返回到在模块子例程中调用的函数。

该程序在 PLATO (Fortran 95) 中运行。

我会感谢任何给我一点帮助的评论,并原谅我写的缺点。

标签: modulefortran

解决方案


See the mentioned details in 1. In summary:

This local declaration overrides the module function within this subroutine. Thus the subsequent reference is looking for an external function of that name, which apparently does not exist, and if it did, then you would not be computing what you think you are computing. Just remove this declaration to fix your problem.


推荐阅读