This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hello, 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) > > > > > > > Ticket Details =================== Ticket ID: YMH-767011 Department: Support netCDF Priority: Normal Status: Closed =================== 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.