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

[netCDF #UCM-204970]: Request for help



Hi Spyros,

> I am trying to compile and link the attached fortran program through the
> command:
> 
> pgf90 -I/home/meteo/airquality/lib/netcdf-4.0.1/include
> -L/home/meteo/airquality/lib/netcdf-4.0.1/lib -lnetcdf
> -L/home/meteo/airquality/lib/netcdf-4.0.1/fortran/.libs -lnetcdff
> metdip.f
> 
> but I get the error messages:
> 
> /tmp/pgf90HEOdJPx5xOuD.o: In function `metdip':
> 
> /home/meteo/airquality/filmaker/fortran/./metdip.f:22: undefined
> reference to `nf_open_'
> 
> /home/meteo/airquality/filmaker/fortran/./metdip.f:23: undefined
> reference to `nf_open_'
 ...

The netCDF Fortran 77 API depends on the C API, so try linking the
libraries in the other order:

  pgf90 -I/home/meteo/airquality/lib/netcdf-4.0.1/include
  -L/home/meteo/airquality/lib/netcdf-4.0.1/fortran/.libs -lnetcdff
  -L/home/meteo/airquality/lib/netcdf-4.0.1/lib -lnetcdf
  metdip.f

Also, make sure the library was built with the same Fortran compiler,
pgf90, that you are using to link your Fortran application against.

It would be somewhat easier to link applications if you run "make
install" after building and testing the library.  That would also
install the "nc-config" application, which you could use to show
exactly how applications could be built.  For example

  $ nc-config --fflags

would show the compiler include flags needed, and 

  $ nc-config --flibs

would show the library flags in the right order for linking against.
You could even use these in the compile command, such as

  $ pgf90 `nc-config --fflags` metdip.f `nc-config --flibs`

Finally, you might have better luck with the latest released version,
4.1.1, which has a few bugs fixed since 4.0.1 and also has a better
implementation of nc-config.

--Russ

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



Ticket Details
===================
Ticket ID: UCM-204970
Department: Support netCDF
Priority: Normal
Status: Closed