[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #LTO-228407]: difference between "-lnetcdf" and "-lnetcdff" ?



Greetings Jatin!

The extra 'f' in the -netcdff refers to the fortran library, whereas -lnetcdf 
is the c library.

Check out

http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-f90/Compiling-and-Linking-with-the-NetCDF-Library.html

and

http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-fortran-install.html

for some more details as to why the two exist (short answer - they are shared 
libraries).

The netCDF tool nc-config will tell you what you need to use when linking to 
the libraries:

For C code:

nc-config --libs

and for FORTRAN code:

nc-config --flibs

Cheers!

Sean

> Hi,
> General question:
> What is the difference between using "-lnetcdf" and "-lnetcdff" when
> compiling fortran programs which use netcdf libs?
> I find on some machines, you only need "-lnetcdf", on other ones you need to
> add "-lnetcdff", otherwise you get lots of "undefined references" to the
> netcdf functions.
> Just wondering out of interest.
> Cheers,
> Jatin.
> 
> 
> ---
> Dr. Jatin Kala
> Research Associate
> Centre of Excellence for Climate Systems Science
> http://www.climatescience.org.au/
> University of New South Wales
> Sydney, NSW, 2052, Australia
> Email: address@hidden or address@hidden
> Phone: +61 2 9385 9393
> 
> 
> 
> 

Ticket Details
===================
Ticket ID: LTO-228407
Department: Support netCDF
Priority: Normal
Status: Open