在编译简单的Fortran程序时,如何修复“未定义的_gfortran_set_std引用”错误?

时间:2013-09-16 19:49:30

标签: gcc gfortran

我正在尝试编译一个名为sandbox.for的简单Fortran程序:

program sandbox
    implicit none
    integer, parameter :: dp = kind(1.0d0)
    real(dp), dimension(2, 2) :: a
    integer :: i

    a = reshape([1, 2, 1, 2], shape(a))
    do i=1,2
        print *, a(i, :)
    end do

end program sandbox

我尝试使用gfortran -ffree-form -o sandbox sandbox.for编译程序,但是我收到以下错误:

/tmp/ccylnLGH.o: In function `MAIN__': sandbox.for:(.text+0x1b):
undefined reference to `_gfortran_set_std' collect2: ld returned 1
exit status

我发现old post表示这可能与旧版本的gcc有关。我在CentOS 5.9 Final上运行gfortran / gcc 4.1.2。邮件建议编译一个较新版本的gcc并安装它,但我没有系统的root权限,所以我无法安装更新的软件。我相信在这个系统上(它是工作中的服务器),gfortran是从存储库安装的,并且保持最新状态。

这个错误是否与我正在使用的gcc和gfortran版本有关,还是有其他问题?

更多信息

yum list | grep libgfortran的输出是这个,如果它有帮助:

libgfortran.i386                   4.1.2-54.el5            installed
libgfortran.x86_64                 4.1.2-54.el5            installed
libgfortran44.i386                 4.4.7-1.el5             base     
libgfortran44.x86_64               4.4.7-1.el5             base

0 个答案:

没有答案