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

[netCDF #HTN-724952]: netCDF in Visual Studio 2013

Hello VIncent,

I apologize for the delay in getting back to you; I am traveling for a 
conference and my email access has been intermittent.

Since this is a problem that occurs at runtime (as opposed to when compiling 
your program), it suggests to me that the system is not able to find the shared 
library (.dll).  This could be an issue with the system path, or it could be an 
issue with the library itself.  You mention you are on Windows 64-bits; are you 
compiling the program using the 64-bit Visual Studio profile, and/or have you 
installed the 64-bit netCDF libraries?

Try copying netcdf.dll into the same directory as the program you are trying to 
run.  By default, Windows will search the current directory when looking for 
shared libraries.  Does the problem change e.g. give you a different error, or 
does it remain the same or, hopefully, does it resolve?

If the error changes, let me know what the new error is.  If the problem 
resolves, then we know it's something to do with the system path and how 
Windows is looking for shared libraries, and isn't a problem with netcdf 
specifically.  Finally, if the issue stays the same, confirm that you are using 
the correct libraries and visual studio settings for your target 'bitness' (32 
vs. 64).

I hope this helps,


> Dear,
> I want to use netCDF formats in a C project using Visual Studio Express
> 2013 on a Windows 64bit, but keep getting the same error.
> I've downloaded the installation file from here:
> http://www.unidata.ucar.edu/software/netcdf/docs/winbin.html
> To add the netCDF functionality in Visual Studio 2013, I did the following:
> - Put #include < netcdf.h > on top
> - In VC++ Directories > Library directories, I added
> C:\Program Files(x86)\netCDF\lib; C:\Program Files (x86)\netCDF 
> - In VC++ Directories > Include directories, I added
> C:\Program Files(x86)\netCDF\include; C:\Program Files (x86)\netCDF 
> - In the linker>input>Additional Dependencies, I added netcdf.lib
> - I placed all files (of the Include, Bin and Lib) in Windows\System32
> However, when I run an example (like simple_xy_wr.c), I get the following
> error:
> " error LNK2019: unresolved external symbol_nc_strerror referenced in 
> function _main "
> What should I do? I've looked into help topics, but did not find a
> solution.  I'm new to Visual Studio. I have been using netCDF in MATLAB
> with success though.
> Thank you in advance,
> Vincent

Ticket Details
Ticket ID: HTN-724952
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.