小编And*_*dez的帖子

同一模块中的子程序未找到模块中的 Fortran 函数

我正在用Fortran90编写一个模块,主要是在模块内部定义了一个函数,以及一个使用该函数的子程序。这是模块的摘录

module Mesh_io
  implicit none
  private
contains
  integer function findkey ( )
    content of this function
  end function
  subroutine getNumber_Mesh ()
    integer :: findkey
    content of the routine
  end subroutine getNumber_Mesh
end module
Run Code Online (Sandbox Code Playgroud)

编译时我得到以下输出:

objects/Main.o: In function `__mesh_io_MOD_getnumber_mesh':
Main.f90:(.text+0x9e): undefined reference to `findkey_'
Run Code Online (Sandbox Code Playgroud)

如您所见,该函数包含在模块中,但由于某种原因编译器找不到它。

oop fortran gfortran

2
推荐指数
1
解决办法
1234
查看次数

标签 统计

fortran ×1

gfortran ×1

oop ×1