For static build, to use netCDF-4 you must link to all the libraries, netCDF, HDF5, zlib, szip (if used with HDF5 build), and curl (if the remote access client has not been disabled).
This will mean -L options to your build for the locations of the libraries, and -l (lower-case L) for the names of the libraries.
For example, one user reports that she can build other applications with netCDF-4 by setting the LIBS environment variable:
LIBS='-L/X/netcdf-4.0/lib -lnetcdf -L/X/hdf5-1.8.6/lib -lhdf5_hl -lhdf5 -lz -lm -L/X/szip-2.1/lib -lsz'
For shared builds, only -lnetcdf is needed. All other libraries will be found automatically.
The ``nc-config –all'' command can be used to learn what options are needed for the local netCDF installation.
For example, this works for linking an application named myapp.c with netCDF-4 libraries:
cc -o myapp myapp.c `nc-config --cflags --libs`