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

[netCDF #AWI-886701]: gennet.f



Hi Anh,

> My name's Anh. Iam a student in Hanoi university of science. Iam doing 
> exercises about using FORTRAN to read netCDF files. I read gennet.f and built
> it. But i had some erros when i run it. They are :
> --------------------Configuration: gennet - Win32 Debug--------------------
> Linking...
> gennet.obj : error LNK2001: unresolved external symbol _NCAINQ@28
> gennet.obj : error LNK2001: unresolved external symbol _NCANAM@24
> gennet.obj : error LNK2001: unresolved external symbol _NCVINQ@36
> gennet.obj : error LNK2001: unresolved external symbol _NCAGTC@32
> gennet.obj : error LNK2001: unresolved external symbol _NCDINQ@24
> gennet.obj : error LNK2001: unresolved external symbol _NCINQ@24
> gennet.obj : error LNK2001: unresolved external symbol _NCOPN@16
> gennet.exe : fatal error LNK1120: 7 unresolved externals
> Error executing link.exe.
> gennet.exe - 8 error(s), 0 warning(s)
> 
> These external symbols were called but I can't find these command in code. 
> Could
> you tell me the way to repair these errors ?

gennet.f needs to be linked to a netCDF library that includes the Fortran-77 
netCDF
interface, containing functions such as NCOPN, NCINQ, ...

You can get the source code to the netCDF library from here:

  ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf.tar.gz

and build the minimal version that only contains the C and Fortran-77 interfaces
(without C++ or Fortran-90 or netCDF-4 or OPeNDAP client) by just running the
following commands in a cygwin development environment:

  ./configure --disable-cxx -disable-f90 --disable-netcdf-4 --disable-dap
  make all
  make check
  make install

Then you can link gennet.o with the netCDF library with something like

  f77 -I/usr/local/include gennet.f -L/usr/local/lib -lnetcdf -o gennet

where instead of "f77" use whatever your Fortran compiler is, and instead
of "/usr/local" use wherever the library gets installed.  You can specify
where to install the library using the  "--prefix=/install/library/here"
option to the configure script, if you don't want to use the default, 
which is "/usr/local/lib".

If you don't want to build the netCDF library from source, and assuming you 
have a Windows sytem, you could also install one of the prebuilt netCDF 
libraries described here:

  http://www.unidata.ucar.edu/software/netcdf/docs/faq.html#windows_netcdf4

--Russ

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



Ticket Details
===================
Ticket ID: AWI-886701
Department: Support netCDF
Priority: Normal
Status: Closed