Install netCDF under mac os
Tips worth of notice I'm using the Interfaces differ greatly between versions.
Installation
Use HomeBrew to install the package. Make sure you have the parameter. This is important to add support for c++.
Compilation
Thanks to CodingAnarchy's question, I found the missing parameter as followed. Otherwise, error keeps apearing that
Reference NetCDF C++ Interface Guide Fail to link using Homebrew Exmple netCDF programs NetCDF4 C++ API
Useful commands
11/14/2016 Weiming
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. 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. 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-compat
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++4
Reference
Useful commands
brew doctor
to analyze your condition of brew packages 11/14/2016 Weiming