Compiling Multiple Files with modules

孤街醉人 提交于 2019-12-12 20:32:41

问题


I am programming in Fortran 90 using GFortran and I'm having troubles with Modules. When I compile the code below, I get the following error:

Derivatives.f90:7.16:
Included at C:\Users\dchalhub\Dropbox\Doutorado\#Tese\New folder\main.f90:1:
    Use Mesh
            1
Fatal Error: Can't open module file 'mesh.mod' for reading at (1): No such file or directory
gfortran.exe: Internal error: Aborted (program f951)
Please submit a full bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

So, the 'mesh.mod' file is not created. But when I remove the first two lines: 'include 'Derivatives.f90'' and 'include 'Poisson.f90'' the module is created without any problems.

After the mod file is created, I put back the first two lines, compile the code again and it works perfectly.

include 'Derivatives.f90'
include 'Poisson.f90'

!**************************************************************
MODULE MESH
IMPLICIT NONE
INTEGER :: IMAX,JMAX,NMAX
REAL(8), ALLOCATABLE :: XD(:),YD(:),FX(:,:),FY(:,:)
REAL(8) :: PI,E,DX,DY,H,L,RHO,MU
PARAMETER (PI = ACOS(-1.D0))
PARAMETER (E = 2.71828182845904523536028747135266249775724709369995)
END MODULE MESH
!**************************************************************



!**************************************************************
!*********** Lid-driven Cavity Program*************************
!**************************************************************
program Cavity
Use Mesh
implicit none


End program Cavity

I don't know why but there is something wrong with compiling multiple files with modules. Does any one know what should I do to make it work properly?

来源:https://stackoverflow.com/questions/17537495/compiling-multiple-files-with-modules

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!