undefined reference

I want to install a field library which uses netcdf and udunits.
I installed without problems netcdf and udunits with pgf90.
When I configure the field library I get a problem at test.f90 with a series of undefined references (below is only a small part of it):

Coordinate_Class.o(.text+0x2d4d): In function coordinate_class_getcoordinateid_': Coordinate_Class.F90: undefined reference to nf_inq_varid_’
Coordinate_Class.o(.text+0x2d6a):Coordinate_Class.F90: undefined reference to nf_inq_varndims_' Coordinate_Class.o(.text+0x2dfe):Coordinate_Class.F90: undefined reference to nf_inq_vardimid_’

TimeSeries_Class.o(.text+0x4848):TimeSeries_Class.F90: undefined reference to nf_enddef_' TimeSeries_Class.o(.text+0x49bb):TimeSeries_Class.F90: undefined reference to nf_put_vara_double_’
Unit_Class.o(.text+0xc9): In function unit_class_initializeunit_': Unit_Class.F90: undefined reference to utmake_’

Unit_Class.F90: undefined reference to utdec_' gmake[1]: *** [depend] Error 2 gmake[1]: Leaving directory /export/Field/src’
make: *** [subdir_depend] Error 2

It looks like it doesn’t recognize the netcdf and udunits libraries. Any idea on why?
Thanks for your help,

Some ideas:

  1. You forgot to add “-lnetcdf” to your link line.
  2. Your mixing 32 and 64-bit objects. (objdump -a libnectdf.a)
  3. Your NetCDF library didn’t build correctly and is missing objects. (nm libnetcdf.a | grep nf_inq_varndims)
  4. Your NetCDF was mis-configured to append 2 underscores instead of one to symbols names. (nm libnetcdf.a | grep nf_inq_varndims)
  • Mat