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 Yu-Long, > I just build libnetcdfc++.a and try to run example.cc under cxx dir. > I got an error message shown below > > example.cc:68: no matching function for call to `NcVar::put (long int[2], > unsigned int)' > netcdf.hh:244: candidates are: NcVar::put(const double *, const long int *) > netcdf.hh:243: NcVar::put(const float *, const long int *) > netcdf.hh:242: NcVar::put(const int *, const long int *) > netcdf.hh:241: NcVar::put(const short int *, const long int *) > netcdf.hh:240: NcVar::put(const char *, const long int *) > netcdf.hh:239: NcVar::put(const unsigned char *, const long > int *) > > thus, I change example.cc code line 68 > from > static long frtimes[] = {12, 18}; > into > static nclong frtimes[] = {12, 18}; > > then I can compile and link w/o problem. The problem is while I run it, > I got a segmentation Fault. Any hint on this problem will be > appreciated. Yes, I didn't realize the old "example.cc" file was still being included in the netCDF source distribution. Your change from "long" to "nclong" for the frtimes[] declaration is correct. But after making this change, I can't duplicate the segmentation fault you are seeing. The resulting program seems to compile and run correctly on both Solaris 2.5 and IRIX64 6.1. On what platform are you seeing the segmentation fault? --Russ ______________________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu