用gfortran忽略固有的伽马函数 [英] Ignoring the intrinsic gamma function with gfortran
问题描述
好,所以我使用的是旧的Fortran代码,该代码定义了与名称为gamma的数学gamma函数无关的函数.
Ok, so I am using this old Fortran code that has defined a function that has nothing to do with the mathematical gamma function with the name gamma.
显然,在较早的Fortran版本中,没有固有的伽马函数.但是,当我使用gfortran编译并运行代码时,该代码实际上使用了新的固有gamma函数,而不是使用此用户定义的gamma函数.
Apparently, in the older Fortran versions, there was no intrinsic gamma function. But when I compile and run the code with gfortran, instead of using this user-defined gamma function, the code actually uses the new intrinsic gamma function.
我是否有办法使用户定义的伽马函数取代固有函数?我想尽可能少地修改代码,即.不要在任何地方重命名用户定义的gamma函数.
Is there a way for me to make the user-defined gamma function supersede the intrinsic one? I'd like to modify the code as less as possible, ie. not rename the user-defined gamma function everywhere.
我尝试在makefile中使用标志 -std = legacy
,但是它不起作用.这可能吗?
I tried using the flag -std=legacy
in the makefile, but it doesn't work. Is this possible?
推荐答案
添加
EXTERNAL GAMMA
到使用 GAMMA
的范围界定单位.
to the scoping unit that uses GAMMA
.
这篇关于用gfortran忽略固有的伽马函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!