I am writing a Fortran code for fluid flow in porous media. I am in the debugging stage. The code solves fluid flow equations using LAPCAK.
I have several modules that have specific tasks. for example, INDEXING MODULE is finding the coordinates and node number for every node in the domain.
I started debugging but I have the following error.
end program main
end module INDEXING
error #7002: Error in opening the compiled module file. Check INCLUDE paths. [INDEXING]
Could you please, explain how to fix this issue?
You need to rearrange the source so the module source appears ahead of the main program source if those are contained in the same physical Fortran source file. As shown and assuming the code resides in the same source file, the USE INDEXING statement is parsed before the module source is; thus, the compiler throws the error noted since the module has not been compiled to create the needed .mod file that the compiler seeks related to the USE INDEXING statement.
Elsayed A. wrote:
What if put every module in a separate sources file? How should I compile it in this case?
Whether you do so or not, the dependency rule remains the same. Before a program unit that contains a USE <xyz> statement can be compiled, the source code for <xyz> should have been compiled successfully. It follows that if the USE <xyz> and MODULE <xyz> are in the same file, the MODULE part should occur earlier in the file. If they are in separate files, the file containing the module should be compiled first.