以下操作是基于docker + ubuntu镜像 + windows terminal + vscode操作。
方法1:安装已经编译好的库。
apt-get update
apt search libnetcdf
然后用apt-get install安装其中的libnetcdf-dev及libnetcdf-c++4-dev。
如果缺少hdf5库,用同样方法安装 即可。
方法2:从 源码编译安装
下载编译hdf5,zlib,netcdf库,参照下面文档
NetCDF Users Guide: Getting and Building netCDF (ucar.edu)
下载源码示例如下:
C++库说明参考下面文档