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

Re: 20050309:Unfamiliar code and error



>To: <address@hidden>
>From: "Sampson, David" <address@hidden>
>Subject: Unfamiliar code and error
>Organization: UCAR/Unidata
>Keywords: 200503091726.j29HQYv2026929

Hi David,

> Russ Rew has been very helpful RE netCDF formats and Fortran90 code.  I
> am trying to read netCDF files for the first time.  Russ kindly sent me
> a simple "starter" program that I am trying to compile (using Compaq
> visual fortran in the MS Visual Studio Environment).  I am getting
> linking errors :
> 
> -------------------Configuration: Unidata - Win32
> Debug--------------------
> Linking...
> Main.obj : error LNK2001: unresolved external symbol
> _NETCDF_mp_NF90_OPEN@20
> Main.obj : error LNK2001: unresolved external symbol
> _NETCDF_mp_NF90_INQUIRE@20
> Main.obj : error LNK2001: unresolved external symbol _NCDINQ@24
> Main.obj : error LNK2001: unresolved external symbol
> _NETCDF_mp_NF90_INQUIRE_DIMENSION@20
> Main.obj : error LNK2001: unresolved external symbol
> _NETCDF_mp_NF90_INQ_VARID@16
> Main.obj : error LNK2001: unresolved external symbol
> _NETCDF_mp_NF90_INQUIRE_VARIABLE@32
> Main.obj : error LNK2001: unresolved external symbol
> _NETCDF_mp_NF90_GET_VAR_3D_FOURBYTEREAL@28
> Main.obj : error LNK2001: unresolved external symbol
> _NETCDF_mp_NF90_GET_VAR_1D_FOURBYTEREAL@28
> Main.obj : error LNK2001: unresolved external symbol
> _NETCDF_mp_NF90_CLOSE@4
>
> I am unfamiliar with this kind of type structure.  Specifically, I do
> not understand the prefix to the function calls.  Is it (netcdf_mp_)
> another TYPE construct?  And, if so, I do not ""see" where it is defined
> (perhaps it is in the library).  Perhaps that's the problem; perhaps the
> program cannot find the netcdf.lib file, although I have placed it in
> the standard folder(s).  Any suggestions would be GREATLY appreciated

No, unfortunately the DLL you downloaded probably did not contain
support for the netCDF Fortran90 interface but just the Fortran-77
interface (I'm assuming you downloaded the DLL from Unidata, but I'm
not sure).  I just checked with our Windows guy, and it turns out we
haven't gotten the Fortran-90 stuff to work for Windows yet in a DLL,
although it's working with lots of Unix Fortran compilers.

Sorry, if I had noticed your original question was about Windows DLL
support, I would have recommended using the Fortran-77 or C interface
rather than Fortran-90.

It's probably possible to build the Fortran-90 support in a static
library rather than a DLL by following the instructions in "Building
and Installing netCDF on Windows":

  
http://www.unidata.ucar.edu/packages/netcdf/docs/netcdf-install/Building-and-Installing-NetCDF-on-Windows.html

by opening the Visual Studio project, and adding a Fortran 90
workspace for the Fortran 90 code, but any problems that result might
require a programmer who knows more about Windows development
environments than I do.

In the example I sent, if you change the "nf90_" prefixes to "nf_"
prefixes instead for the netCDF arguments and adjust the parameter
lists to the API described in the netCDF Fortran-77 User's Guide,
you might get past the link errors, and we could help with remaining
problems.

--Russ

_____________________________________________________________________

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