小编Had*_*ali的帖子

使用所有可用库编译 Fortran netCDF 程序

首先,我已经阅读了这个主题,但我无法编译我的代码。 在 Ubuntu 上编译 Fortran netCDF 程序

我在 UBUNTU 14.04 上编译一个使用 NetCDF 的 fortran 程序。我有这样的编译错误:

terrain.f:(.text+0x17efd): undefined reference to 'ncopn_'
terrain.f:(.text+0x18111): undefined reference to 'ncopn_'
terrain.f:(.text+0x187cc): undefined reference to 'ncclos_'
terrain.f:(.text+0x187ea): undefined reference to 'ncclos_'
Run Code Online (Sandbox Code Playgroud)

它肯定说我没有 netcdf fortran 库。但我根据这些网页安装了 zlib、HDF5、netcdf C 和 netcdf Fortran,并禁用共享和禁用 dap 选项。

http://www.unidata.ucar.edu/software/netcdf/docs/build_default.html http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-fortran-install.html

这是 nc-config --libs 命令的结果:

-L/usr/local/lib -L/usr/local -lnetcdf -lhdf5_hl -lhdf5 -ldl -lm -lz
Run Code Online (Sandbox Code Playgroud)

这是 nf-config --flibs 命令的结果:

-L/usr/local/lib -lnetcdff -L/usr/local/lib -lnetcdf -lnetcdf -lhdf5_hl -lhdf5 -lz
Run Code Online (Sandbox Code Playgroud)

我用这个命令构建我的项目:

gfortran terrain.f -I/usr/local/include -L/usr/local/lib -lnetcdff -lnetcdf -lhdf5_hl …
Run Code Online (Sandbox Code Playgroud)

fortran compilation netcdf

1
推荐指数
1
解决办法
1606
查看次数

标签 统计

compilation ×1

fortran ×1

netcdf ×1