fortran - 对 gfortran_runtime_error 的 undefined reference

标签 fortran ubuntu-14.04 gfortran

我想在Ubuntu 14.04下运行一个Fortran90编写的模型。我使用 gfortran 95 编译器(gfortran 4:4.8.2-1ubuntu6)。按照以下建议安装所需的 netCDF 库(netCDF C 和 Fortran netCDF):http://www.unidata.ucar.edu/software/netcdf/docs/ 。 netcdf 被构建为共享库,因此 libnetcdf.so 和 libnetcff.so 文件位于库目录中。 libgfortran3 4.8.2-19ubuntu1 是为链接到共享库的 GNU fortran 应用程序安装的。 LDFLAGS 通过以下方式在compiler_options.inc 文件中设置:

INCDF=-I$(NCPATH)/include
LNCDF=-L$(NCPATH)/lib -lnetcdff -lnetcdf
LDFLAGS=$(INCDF) $(LNCDF)

当我编译模型时,我收到以下消息:

/home/Beata/kid_a_setup/src/test_cases_2d.f90:1446: undefined reference to `_gfortran_runtime_error_at

有人可以向我解释一下导致错误的原因以及如何修复它吗?

最佳答案

_gfortran_runtime_error_at 的 undefined reference 意味着尚未找到 libgfortran 库。

您的系统配置错误(您可以使用gfortran编译、链接和运行“Hello, world”程序吗?),或者您正在使用gcc命令链接而不是 gfortran 进行链接。 gcc 不知道 libgfortran 库,其中定义了 _gfortran_runtime_error_at。

关于fortran - 对 gfortran_runtime_error 的 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28299411/

相关文章:

docker - 如何在 Ubuntu 14 上解决 "Rather than invoking init scripts...."

hdfs - Ambari 服务器容错

fortran - 访问主程序子目录中的文件

windows - MinGW gfortran编译错误: “Unrecognized option ' -plugin' ”

multidimensional-array - 在Fortran 90中使用2d数组与派生类型的数组

android - 在 ubuntu 上安装 android studio

数组和派生类型

arrays - 在循环中为数组赋值

fortran - 来自 Fortran 代码的 RECTILINEAR_GRID 的二进制 VTK

compiler-errors - 如何使用ifort编译器编写makefile?