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

[netCDF #SGX-345422]: Compiling with gfortran and refernece to netcdf libraries

Hi Sophie,

> I have had a lot of trouble installing netcdf and gfortran on my mac os x 
> 10.6 and was hoping for some direction. I thought I had gfortran and netcdf 
> 4.1 installed correctly, but I can't seem to getting the linking flags 
> correct.

I assume this means that you ran "make check" and "make install", and both 

> When I try and compile a script with a -lnetcdff reference (gfortran test.f 
> -o test -I/opt/local/include -I/usr/include -lnetcdf), I get a error beginning
> >Undefined symbols:
> >  "_nf_put_att_text_", referenced from:


  gfortran -I/opt/local/include test.f -o test -L/opt/local/lib -lnetcdff 

> When I try nc-config --flibs, it returns
> > -L/opt/local/lib -lnetcdff -lnetcdf
> But then when I try to compile with
> gfortran test.f -o test  -I/opt/local/include -I/usr/include -lnetcdf 
> -llnetcdf

That was missing the "-L/opt/local/lib" ...

> I get
> ld: library not found for -llnetcdf
> Can someone please provide some direction for installing with the correct 
> libraries? I'm really not sure what I've done wrong here.

Please let us know if the gfortran invocation line above doesn't work.


Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu

Ticket Details
Ticket ID: SGX-345422
Department: Support netCDF
Priority: Normal
Status: Closed

NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.