Compiling with gfortran: undefined reference to iargc_

て烟熏妆下的殇ゞ 提交于 2019-11-28 00:33:04
Vladimir F

The problem is very similar to Fixing FORTRAN IV warning: "The number of arguments is incompatible with intrinsinc procedure, assume 'external' " but the difference is that in the other question there was an external function present and the similarity with an intrinsic was inadvertent, but you are calling the intrinsic on purpose.

The statement

EXTERNAL IARGC

meant that IARGC is an external or an intrinsic function in FORTRAN 66, but in "modern Fortran" 77 and later it means that it is an external function only.

But you need to call the intrinsic function https://gcc.gnu.org/onlinedocs/gfortran/IARGC.html .

You should use

 INTRINSIC IARGC

or even just delete IARGC from the EXTERNAL statement without adding anything else. The compiler will then stop searching for a non-existent external function and will use the intrinsic.

A final note, IARGC itself is not standard Fortran, ut it shouldn't matter here.

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