Next: , Previous: Installation, Up: Building on Unix



3.9 Using NetCDF

To use netCDF you must link to the netCDF library, and, if using the netCDF-4/HDF5 features, also two HDF5 and at least one compression library.

Use the -L option to your linker to pass the directories in which netCDF, HDF5, and zlib are installed.

Use the -l (lower-case L) option to list the libraries, which must be listed in the correct order:

-lnetcdf -lhdf5_hl -lhdf5 -lz

On some systems you must also include -lm for the math library.

If szip was used when building HDF5, you must also use -lsz.