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.
> Hi, I'm still trying to install the NetCDF library so I can use it with > Visual Studio 2010. > > My code looks like this (a shortened version of one of the examples): > > #include <iostream> > #include <netcdfcpp.h> > using namespace std; > > const int NX = 6; > const int NY = 12; > > int main() > { > int dataOut[NX][NY]; > > // Create some pretend data. If this wasn't an example program, > we > // would have some real data to write, for example, model > output. > for(int i = 0; i < NX; i++) > for(int j = 0; j < NY; j++) > dataOut[i][j] = i * NY + j; > > // Create the file. The Replace parameter tells netCDF to overwrite > // this file, if it already exists. > NcFile dataFile("simple_xy.nc", NcFile::Replace); > > cout << "done"; > return 0; > } > > > I get the following error messages: > > 1>read_netcdf_narr.obj : error LNK2019: unresolved external symbol > "public: virtual __thiscall NcFile::~NcFile(void)" (??1NcFile@@UAE@XZ) > referenced in function _main > 1>read_netcdf_narr.obj : error LNK2019: unresolved external symbol > "public: __thiscall NcFile::NcFile(char const *,enum > NcFile::FileMode,unsigned int *,unsigned int,enum NcFile::FileFormat)" > (??0NcFile@@QAE@PBDW4FileMode@0@PAIIW4FileFormat@0@@Z) referenced in > function _main > > > What am I doing wrong? > Cheers, > Anders > > > Are you using the netcdf DLL from Unidata? If so, it does not contain the C++ API, just the netcdf C API. Thanks, Ed Ticket Details =================== Ticket ID: KST-627463 Department: Support netCDF Priority: Normal Status: Closed