NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.


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

Re: 20040838: netCDF, Windows XP, Compac Visual Fortran 6.6: please help!



Elizabeth North <address@hidden> writes:

> Dear Ed,
>   Thank you very much for your rapid response! My answers to your
> helpful questions are below.
> 
> Regards,
> Elizabeth
> 
> On Mon, 30 Aug 2004, Ed Hartnett wrote:
> 
> > Unidata Support <address@hidden> writes:
> >
> > > ------- Forwarded Message
> > >
> > > >To: address@hidden
> > > >From: Elizabeth North <address@hidden>
> > > >Subject: netCDF, Windows XP, Compac Visual Fortran 6.6: please help!
> > > >Organization: UCAR/Unidata
> > > >Keywords: 200408281910.i7SJAc8E002365
> > >
> > >
> > > Dear netCDF support,
> > >   I am using Compac Visual Fortran 6.6 and would like create a program
> > > that reads in a series of large (1.7 GB) netCDF files that were created by
> > > the ROMS circulation model. I have attempted to follow the directions
> > > in the WIN32_README.TXT. I am having trouble with both the pre-built
> > > binaries AND with building the libraries, and have questions that
> > > I hope you would help me with.
> >
> > What version of visual studio are you using?
> >
>   I think it is Visual Studio 6.0
> 
> > Also, what version of the netCDF dll are you using?
> 
>   I used the netCDF.dll that was unpacked with the NetCDF 3.5.0 download.
> 
> > >
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > 1. If I want to create a Fortran program that reads in .nc files, can I
> > > use pre-built binaries?
> > >
> > >   Well, I tried it. I placed:
> > > netcdf.inc   in d:/program files/microsoft visual studios/df98/include
> > >
> > > netcdfs.lib in d:/program files/microsoft visual studios/df98/lib
> > >
> > > ncgens.exe in d:/program files/microsoft visual studios/df98/bin
> > > ncdumps.exe in in d:/program files/microsoft visual studios/df98/bin
> > >   which are in my system's PATH
> > >
> > >   I also put netcdf.inc in d:/oyster/  and tried to run this simple
> > > program (d:/oyster/test.f):
> > >
> > >         program main
> > >   include "netcdf.inc"
> > >   write(*,*) 'Run nccre'
> > >   ncid = nccre('test2.nc',NCCLOB,iret)
> > >   write(*,*) ncid
> > >   end
> > >
> > > It compiled, but did not link. Here is the error message:
> > >
> > >    test.obj : error LNK2001: unresolved external symbol _NCCRE@16
> > >    Debug/test.exe : fatal error LNK1120: 1 unresolved externals
> > >    Error executing link.exe.
> > >
> > >    test.exe - 2 error(s), 0 warning(s)
> > >
> > > If I can use the pre-built libraries, then what am I doing wrong?
> >
> > You can use the pre-built libraries.
> >
> > Unfortunately I'm not familiar with Compaq fortran. Are you includings
> > the dll in the link?
> >
> 
>   Thank you! I was not 'telling' the program where to find the netcdf
> library. It turns out that I needed to add netcdf.lib to the project by
> going to "Project" --> "Add to Project" --> "Files" then adding
> d:/program files/microsoft visual studios/df98/lib/netcdf.lib
> 
>   Also, I used the dynamic version of the pre-built libraries (netcdf.lib)
> instead of the static version (netcdfs.lib).
> 
>   Once I did this, the program compiled, linked, and ran.
> 
> > Also, what is nccre? You should be using NF_CREATE to create from
> > fortran.
> 
>   I looked at netcdf.inc, and nccre is in the 'backwards' compatibility
> section. This program was written by a colleague of mine who has been using
> netcdf for some time. I've changed it to reflect the updated syntax:
>         program main
>         include "netcdf.inc"
>         write(*,*) 'Run nf_create'
>         ncid = nf_create('test2.nc',nf_clobber,iret)
>         write(*,*) ncid
>         end
> 
>   Thanks so much for your help! --Elizabeth


Oppps, my fault, I didn't check the version 2 interface, which works
perfectly well, so there's no need at all to convert if you don't want
to.

I'm glad your code works! Good luck!

Ed Hartnett
Unidata