I need to build a Fortran program that uses (among others) the library netcdf, which I downloaded using apt-get (my computer is on Ubuntu 20.04). Installing the library worked, the share object files for the library are there, but upon running the makefile of the program I need to install, it doesn't work because it doesn't find the include files for this library. I am not familiar with Fortran, is it a common thing to need the include file in this case? As far as I know (or rather experienced), linking such libraries doesn't require include files in C++. I assume if I needed them normally, I should have had got them when installing the library.
Thank you for your help!


You have to install necessary NetCDF development package for fortran by

sudo apt-add-repository universe
sudo apt-get install libnetcdff-dev

and then retry building your application.

  • The general rule of thumb to get the development header files is to append -dev to the name of the library package. – Alex Hajnal May 7 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.