Kris, > I did not compile netcdf initially, so I do not really know what > options were used. When I do this, I get the error: > > /usr/local/netcdf/lib/libnetcdff.so: undefined reference to > `_gfortran_os_error' > collect2: ld returned 1 exit status > > I do not seem to have any older libraries lying around. Have you ever > seen the above error? No, sorry, I haven't seen that. It's not clear from the above what "When I do this" refers to. Were you trying to build netCDF from the currently released version 4.1.1 sources, available from ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf.tar.gz ? If so and the attempt to build and install from sources failed, please send us the information requested here: http://www.unidata.ucar.edu/netcdf/docs/netcdf-install/Reporting-Problems.html so we can try to diagnose the problem. Thanks. If instead "When I do this" referred to trying gfortran -o ncread_test ncread_test.o -L/usr/local/netcdf/lib -lnetcdf -lnetcdff then the error message could be an indication that you are using a older version of gfortran than the netCDF Fortran library was built with. In this case, the solution would be to find out what version of gfortran was used to build the netCDF library and use that version or later. --Russ > On Aug 30, 2010, at 12:36 PM, Unidata netCDF Support wrote: > > > Hi Kris, > > > >> I've written code to read a netcdf file in fortran 90. I have the > >> netcdf 4.0.1 software installed on my Linux machine. Here are my > >> compile commands: > >> > >> gfortran -c -I/usr/local/netcdf/include ncread_test.f90 > >> gfortran -o ncread_test ncread_test.o -L/usr/local/netcdf/lib - > >> lnetcdf > >> > >> In my code, I have the statement: INCLUDE 'netcdf.inc' > >> > >> When I compile, I get a slew of "undefined reference to" messages: > >> > >> ncread_test.f90:(.text+0x8b): undefined reference to `nf_open' > >> ncread_test.f90:(.text+0x13a): undefined reference to `nf_strerror' > >> ncread_test.f90:(.text+0x189): undefined reference to `nf_inq_varid' > >> ncread_test.f90:(.text+0x238): undefined reference to `nf_strerror' > >> ncread_test.f90:(.text+0x279): undefined reference to > >> `nf_inq_varndims' > >> > >> In my include statement, I have tried including the full path to the > >> netcdf.inc, but this did not work either. What am I doing wrong > >> here > > > > If you built shared rather than static libraries using the configure > > option > > --enable-shared, or if you requested a separate Fortran library > > using the > > configure option --enable-separate-fortran, then you need to > > specify one > > more library on the link command, -lnetcdff. So instead of > > > > gfortran -o ncread_test ncread_test.o -L/usr/local/netcdf/lib - > > lnetcdf > > > > try > > > > gfortran -o ncread_test ncread_test.o -L/usr/local/netcdf/lib - > > lnetcdf -lnetcdff > > > > If that doesn't work, make sure you don't have an older shared > > library for netCDF > > installed some place that will be searched first, such as /usr/lib. > > If so and if > > that library didn't include a Fortran interface, that would also > > cause the symptom > > you are reporting. > > > > --Russ > > > > Russ Rew UCAR Unidata Program > > address@hidden http://www.unidata.ucar.edu > > > > > > > > Ticket Details > > =================== > > Ticket ID: ESV-218399 > > Department: Support netCDF > > Priority: Normal > > Status: Closed > > > > ========================================================= > Kristopher Bedka > Science Systems & Applications, Inc. @ NASA Langley Research Center > 1 Enterprise Parkway, Suite 200 > Hampton, VA 23666 > Phone: (757) 951-1920 > Fax: (757) 951-1902 > address@hidden > ========================================================= > > > > > Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: ESV-218399 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.