This question already has an answer here:
- Why is this a function declared inside the module and then used somewhere else in the same module not seen by the linker? 2 answers
I am writing a module in Fortran90, Mainly I defined a function inside the module, and a subroutine that uses the function. Here's an excerpt of the module
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
When compiling I get the following output:
objects/Main.o: In function `__mesh_io_MOD_getnumber_mesh':
Main.f90:(.text+0x9e): undefined reference to `findkey_'
As you can see the function is contained in the module, but for some reason the compiler can not find it.