[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDF #YMH-767011]: Help with compiling and linking in Windows
- Subject: [netCDF #YMH-767011]: Help with compiling and linking in Windows
- Date: Tue, 10 Jul 2018 12:26:01 -0600
Hi Russ,
Reviewing netcdf.h, you appear to be correct that DLL_NETCDF is required,
although interestingly enough we *don't* use this flag when compiling the
netCDF utilities on Windows and linking against the netcdf dll. Since Visual
Studio is a secondary product for me, I need to go figure out if this is
*required* or not. In the meantime, what you are doing, if not necessary,
certainly won't be causing any harm.
So I have access to the Community Editions of Visual Studio 2015 and 2017.
The developer command prompt doesn't give me access to the 'Cl' command; it
could be I'm doing something wrong or just am unfamiliar with the tool, but so
far I haven't been able to get it to run on my end. I've found the 2013
Express download and will give that a shot but it will take a little time. It
also appears to only be available as a 32-bit version. Give the 32-bit
libraries a try and let me know if it fixes things. In the meantime, I will
follow up when I have installed Visual Studio 2013 Express and tried it out on
my end.
-Ward
On Jul 10, 2018, 12:20 AM -0600, Russ Jones <address@hidden>, wrote:
> New Client Reply: Help with compiling and linking in Windows
>
> Hi, thanks for your reply.. I am using visual studio express 2013 for
> Desktop.
>
> The pre-built libraries I downloaded and installed are the 64-bit
> libraries. It occurred to me that could be an issue but I have not yet
> tried it with the 32-bit libraries.
>
> In reading the netcdf.h file, I see that there is an #ifdef directive, and
> that if the macro DLL_NETCDF is defined (lines 481-491 in netcdf.h) then
> all the extern declarations are preceeded with "__declspec(dllimport)"
> which as I understand it is required to link to a DLL export library (and
> "-Dmacroname" defines "macroname" on the CL command line).
>
> As to whether I'm compiling a 64-bit program, I can find no specific
> compiler flags to specify a program is 64-bit or not.
>
> Thanks in advance for your help, it's much appreciated.
> Russ Jones
>
>
>
> address@hidden> wrote:
>
> > Check to see if the directory containing netcdf.lib and netcdf.dll
> > is included in your PATH environment variable.
> >
> > >
> > > I don't have a *lot* of experience working with Visual Studio, but I
> > will help as best I can. What you are describing sounds like an error
> > during linking. While unfamiliar with the CI tool, it appears you are
> > working with the correct file (the .lib import library, not the .dll
> > directly). You shouldn't need to specify -DDLL_NETCDF, nor should you need
> > to modify any files.
> > >
> > > What version of Visual Studio are you using, if I may ask? Let me play
> > around with my copy of VS and the CI command, and I will follow up with
> > you. If you can tell me what version of VS you are using (to make sure
> > we're on the same page), and if you can also confirm you are compiling a
> > 64-bit program, not a 32-bit program, that will be great. I will follow up
> > as soon as I have more information!
> > >
> > > Have a great day,
> > >
> > > -Ward
> > >
> > > > Hello,
> > > >
> > > >
> > > >
> > > > I am trying to write a C program using netcdf. I have started with a
> > simple program to simply open a netcdf file and read its dimensions and a
> > variable. I’ve attached the C source code.
> > > >
> > > >
> > > >
> > > > I downloaded and installed the “netCDF4.6.1-NC3-64.exe” installer and
> > installed everything.
> > > >
> > > >
> > > >
> > > > I copied my source file, and the files “netcdf.h”, netcdf.lib”, and
> > “netcdf.dll” all to the same folder, and from a Visual Studio developer
> > command prompt, typed
> > > >
> > > >
> > > >
> > > > Cl nctest.c netcdf.lib
> > > >
> > > >
> > > >
> > > > I have also tried
> > > >
> > > >
> > > >
> > > > Cl –DDLL_NETCDF nctest.c netcdf.lib
> > > >
> > > >
> > > >
> > > > As well as trying adding the line “#define DLL_NETCDF” prior to the
> > #include “netcdf.h” statement in the source file.
> > > >
> > > >
> > > >
> > > > I get “LINK2019: unresolved external symbol” errors for every netcdf
> > library function call. But executing “dumpbin /exports netcdf.lib” shows
> > that all the symbols are exported in the lib file as expected.
> > > >
> > > >
> > > >
> > > > Can you advise me how to fix this problem? Any help will be much
> > appreciated, I am about at my wits end trying to get this to work.
> > > >
> > > >
> > > >
> > > > Thanks
> > > >
> > > > Russ Jones
> > > >
> > > > Senior Member, Institute for Electrical and Electronics Engineers
> > (IEEE)
> > > >
> > > > +966 11 808 5579 (KSA office) ? +966 54 479 4880 (KSA mobile) ? +1 310
> > 469 9045 (worldwide VOIP) ? +1 714 206 2556 (US mobile) ? Skype: rkj90266
> > > >
> > > > address@hidden (work) ? address@hidden (personal)
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
> > =Dennis Heimbigner
> > Unidata
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: YMH-767011
> > Department: Support netCDF
> > Priority: Normal
> > Status: Open
> > ===================
> > NOTE: All email exchanges with Unidata User Support are recorded in the
> > Unidata inquiry tracking system and then made publicly available through
> > the web. If you do not want to have your interactions made available in
> > this way, you must let us know in each email you send to us.
> >
> >
> >
>
>
>
> Ticket Details
> ===================
> Ticket ID: YMH-767011
> Department: Support netCDF
> Priority: Normal
> Status: Open
> Link:
> https://andy.unidata.ucar.edu/esupport/staff/index.php?_m=tickets&_a=viewticket&ticketid=29509
>
Ticket Details
===================
Ticket ID: YMH-767011
Department: Support netCDF
Priority: Normal
Status: Open
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata
inquiry tracking system and then made publicly available through the web. If
you do not want to have your interactions made available in this way, you must
let us know in each email you send to us.