gfortran 编译netcdf出现的问题

2020-01-18  本文已影响0人  长工张三

gfortran nc.f90 -I/mnt/f/longbow/Build_WRF/LIBRARIES/netcdf/include -L/mnt/f/longbow/Build_WRF/LIBRARIES/netcdf/lib -lnetcdf -o nc.exe >& 1.out

出现的错误信息为:

/tmp/ccfo8EnJ.o: In function `MAIN__':

nc.f90:(.text+0x395): undefined reference to `nf_open_'

nc.f90:(.text+0x418): undefined reference to `nf_strerror_'

nc.f90:(.text+0x478): undefined reference to `nf_inq_'

nc.f90:(.text+0x4e2): undefined reference to `nf_strerror_'

nc.f90:(.text+0x59e): undefined reference to `nf_inq_dim_'

nc.f90:(.text+0x608): undefined reference to `nf_strerror_'

nc.f90:(.text+0x73b): undefined reference to `nf_inq_var_'

nc.f90:(.text+0x7a9): undefined reference to `nf_strerror_'

nc.f90:(.text+0x956): undefined reference to `nf_inq_attname_'

nc.f90:(.text+0x9c0): undefined reference to `nf_strerror_'

nc.f90:(.text+0xa9f): undefined reference to `nf_inq_atttype_'

nc.f90:(.text+0xb09): undefined reference to `nf_strerror_'

nc.f90:(.text+0xbe8): undefined reference to `nf_inq_atttype_'

nc.f90:(.text+0xc52): undefined reference to `nf_strerror_'

collect2: error: ld returned 1 exit status

问题解决了,查了半天资料,什么原因还是不了解。最后成功的编译方式如下:

gfortran -o nc.exe nc.f90 //mnt/f/longbow/Build_WRF/LIBRARIES/netcdf/lib/libnetcdff.a //mnt/f/longbow/Build_WRF/LIBRARIES/netcdf/lib/libnetcdf.a -I//mnt/f/longbow/Build_WRF/LIBRARIES/netcdf/include

上一篇 下一篇

猜你喜欢

热点阅读