编译错误:无法打开模块文件 [英] Error in compiling: Can't open module file
本文介绍了编译错误:无法打开模块文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有此代码:
PROGRAM xfit
! driver for routine fit
USE nrtype; USE nrutil
USE nr
USE ran_state, ONLY : ran_seed
IMPLICIT NONE
INTEGER(I4B), PARAMETER :: NPT=100
REAL(SP), PARAMETER :: SPREAD=0.5_sp
INTEGER(I4B) :: mwt
REAL(SP) :: a,b,chi2,q,siga,sigb
REAL(SP), DIMENSION(NPT) :: harvest,sig,x,y
call ran_seed(sequence=731)
x(:)=arth(0.1_sp,0.1_sp,NPT)
call gasdev(harvest)
y(:)=-2.0_sp*x(:)+1.0_sp+SPREAD*harvest
sig(:)=SPREAD
do mwt=0,1
if (mwt == 0) then
write(*,'(//1x,a)') 'Ignoring standard deviation'
call fit(x,y,a,b,siga,sigb,chi2,q)
else
write(*,'(//1x,a)') 'Including standard deviation'
call fit(x,y,a,b,siga,sigb,chi2,q,sig)
end if
write(*,'(1x,t5,a,f9.6,t24,a,f9.6)') 'A = ',a,'Uncertainty: ',&
siga
write(*,'(1x,t5,a,f9.6,t24,a,f9.6)') 'B = ',b,'Uncertainty: ',&
sigb
write(*,'(1x,t5,a,4x,f10.6)') 'Chi-squared: ',chi2
write(*,'(1x,t5,a,f10.6)') 'Goodness-of-fit: ',q
end do
END PROGRAM xfit
但是当我编译它时,出现以下错误
But when I compile it I get the following error
USE ran_state, ONLY : ran_seed
1
Fatal Error: Can't open module file 'ran_state.mod' for reading at (1):
No such file or directory
您能告诉我我该怎么解决吗?
Could you please tell me how I can solve it?
推荐答案
像这样构建时,我看到了相同的错误:
I've seen the same error when I built like this:
gfortran test.f90 -o test.exe
使用模块名
use modulename
1
致命错误:无法打开模块文件'modulename.mod'以便在以下位置读取 (1):没有这样的文件或目录
Fatal Error: Can't open module file 'modulename.mod' for reading at (1): No such file or directory
假设modulename.mod位于/usr/local/include
中,并且在/usr/local/lib
中具有某些依赖性.
Let's say modulename.mod is in /usr/local/include
with some dependencies in /usr/local/lib
.
您可以通过以下操作使错误消失:
gfortran test.f90 -o test.exe -I/usr/local/include -L/usr/local/lib
这篇关于编译错误:无法打开模块文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文