Install netCDF under mac os

Tips worth of notice

  • I'm using the cpp interfaces. It requires you first install the basic netCDF C class and then install the interface for cpp, because the cpp interface is based on the classic model.html

  • netcdf.h is the header file for C interface; netcdfcpp.h is the older version of CPP version, and the newest version will use the header file netcdf instead.c++

  • Interfaces differ greatly between versions.git

Installation

Use HomeBrew to install the package. Make sure you have the parameter. This is important to add support for c++.
brew install netcdf --with-cxx-compatgithub

Compilation

Thanks to CodingAnarchy's question, I found the missing parameter as followed. Otherwise, error keeps apearing that linking command fails.
g++ test.cpp -lnetcdf_c++4ide

Reference

Useful commands

  • brew doctor to analyze your condition of brew packagesip

11/14/2016 Weiming

相關文章
相關標籤/搜索