1

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

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

我发现一篇旧帖子说这可能与旧版本的 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
4

0 回答 0