Fortran 和实际过程关联的伪参数不同于伪过程的伪参数

Fortran 和实际过程关联的伪参数不同于伪过程的伪参数,fortran,fortran90,Fortran,Fortran90,我使用IMSL Fortran库中的函数来解非线性方程组,得到3个误差。我正在x64系统上使用Visual Studio 2017。错误说明如下: Error #7061: The characterístic of dummy argument 1 of the associated actual procedure differ from the characteristics of dummy argument 1 of the dummy procedure [FCN_SS] Err

我使用IMSL Fortran库中的函数来解非线性方程组,得到3个误差。我正在x64系统上使用Visual Studio 2017。错误说明如下:

Error #7061: The characterístic of dummy argument 1 of the associated actual procedure differ from the characteristics of dummy argument 1 of the dummy procedure [FCN_SS]


Error #7062: The characterístic of dummy argument 2 of the associated actual procedure differ from the characteristics of dummy argument 2 of the dummy procedure [FCN_SS]

Error #7063: The characterístic of dummy argument 3 of the associated actual procedure differ from the characteristics of dummy argument 3 of the dummy procedure [FCN_SS]
代码是:

    include 'link_fnl_shared.h' 

    use neqnf_int
    use umach_int

    implicit none

!Declaring variables
    .
    .
    .

    Contains

    subroutine solve_ss(x, fnorm)

        integer n
        parameter (n=2)

        integer k, nout
        real(dp) :: fnorm, x(n), xguess(n)

        data xguess/1.0_dp, 0.3_dp/   !guess for total output in units

        call umach (2, nout)
        call neqnf (fcn_ss, x, xguess=xguess, fnorm=fnorm)

    end subroutine solve_ss


    subroutine fcn_ss(x, f, n)

        implicit none

        !specification
        integer n
        real(dp) :: x(n), f(n)

    .
    .
    .

    F(1)=...

    F(2)=...

    end subroutine fcn_ss

我不确定错误是关于什么的,因为变量的声明在
solve\u ss
fcn\u ss
中是相同的

库的文档明确说明(和)您需要
使用相应的模块,以便访问例程的现代实现

否则,您可能(我无法测试,但我是基于)访问库的遗留支持。因此,与其使用通用Fortran 90接口,还不如使用Fortran 77专用接口:

NEQNF (FCN, ERRREL, N, ITMAX, XGUESS, X, FNORM)
其他细节是,文档明确说明必须将传递的函数声明为外部函数:

external fcn_ss

不过,我不确定这些猜测。可能是那个或任何其他奇怪的错误。请提供反馈。

尝试拨打
D_NEQNF
,而不是
NEQNF
(最终也是
DNEQNF
)。最好是制作一个可编译的。您在IMSL include文件夹中有模块neqnf_int的源代码。我再也不能访问这个了,但是它是数字库或者类似的东西。在文本编辑器(或Visual Studio)中打开它,找到NEQNF的声明及其细节,并与您的FCN_SS进行比较。实际上,我不确定。我只是注意到文档中有说明,但在调用中没有遵循。我仍然试图在web中找到函数的源代码,以比较声明。是否应该更好地将其转换为评论?好吧,我想我们之间已经混淆了任何查看编辑的人……在我看来,OP确实使用了一些名称为NEQNF的模块。我认为NEQNF_INT提供了接口。至少名字暗示了这一点。对不起,伙计们。我误读了这个问题,认为OP包含了例程而不是使用模块,所以我写了这个编辑。但后来我意识到他确实使用了,所以编辑不再有意义了;这就是为什么我将其回滚,我不知道答案,所以请选择最适合您想法的版本。我的编辑是基于你的一个,但在我选择的那一个上有点冲突:它不是故意选择一个而不是另一个。