You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Fortran95模块函数调用缺失符号:编译警告与运行时错误求助

Fixing "Missing Routine" Error for Private Fortran Module Function

This is a classic name collision issue in Fortran modules—let's break down what's happening and fix it:

Root Cause

In your dsftdw subroutine, you’ve declared a local logical variable named dless. This overrides the private module function dless you intend to call. The compiler prioritizes the local variable over the module function, so it never links to the actual function implementation—hence the missing symbol warning and runtime error.

Step-by-Step Solution

  1. Remove the conflicting local variable declaration
    In your dsftdw subroutine, delete this line entirely:

    logical :: dless
    

    Since dless is a private function in the same module, the subroutine already has access to it without needing a local declaration. The local variable was masking the function entirely.

  2. Clean up minor syntax (optional but recommended)
    In your dless function, there’s a missing colon in an integer declaration:

    integer(kind =3) k  ! Missing ::
    

    Update it to:

    integer(kind=3) :: k
    

    Most compilers will tolerate the original syntax, but fixing this avoids potential parsing quirks.

  3. Recompile and test
    Rebuild your code in PLATO—this should eliminate the missing symbol warning and runtime error, as the subroutine will now correctly reference the module’s dless function.

Why This Works

Fortran follows scope rules where local declarations take priority over module-level symbols. By removing the local dless variable, the subroutine falls back to using the private module function defined in the contains section of your module.

内容的提问来源于stack exchange,提问作者ALIN

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 08:17:45