Can gFortran Link Against Cygwin netCDF Library?

Marco Atzeri
Tue Nov 25 00:01:00 GMT 2014

On 11/24/2014 10:28 PM, John Kim wrote:
> Hi,
> I have a C program that uses a custom Fortran library and the netCDF
> API. I'm trying to link the C and Fortran object files with the Cygwin
> netCDF library, like this:
>     gfortran *.o libfortran.a -L"/cygdrive/c/Program Files (x86)/netCDF
>" -lnetcdf
> But it says "undefined reference" to all the netcdf API functions. The
> netCDF installation I have is from the Cygwin Setup.exe installer. Do
> I need to compile the netCDF source in a special way to make it
> visible to the gfortran linker? Compiling netCDF is a major task so I
> thought I'd ask before I give that a try....
> Thanks,
> -John

1)  C API or Fortran API for NetCDF ?

2)  Have you installed libnetcdf-devel package and
     libnetcdf-fortran-devel ?

3)  why -L"/cygdrive/c/Program Files (x86)/netCDF" ?
     The latest cygwin libnetcdf-devel package is 4.3.2-2
     and its library is:

     $ cygcheck -l libnetcdf-devel |grep dll


Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list