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.
> That almost worked! > > Now I have more interesting errors. I think this is something with object > files. > > [ltharri1@coiti282 cxx]$ g++ -I/home/ltharri1/Desktop/netcdf-3.6.2/libsrc > oldconversion.cpp > /tmp/ccLrwJsP.o(.text+0x131): In function `main': > : undefined reference to `NcFile::NcFile(char const*, NcFile::FileMode, > unsigned int*, unsigned int, NcFile::FileFormat)' > /tmp/ccLrwJsP.o(.text+0x140): In function `main': > : undefined reference to `NcFile::is_valid() const' > /tmp/ccLrwJsP.o(.text+0x153): In function `main': > : undefined reference to `NcFile::~NcFile()' > /tmp/ccLrwJsP.o(.text+0x176): In function `main': > : undefined reference to `NcFile::get_var(char const*) const' > /tmp/ccLrwJsP.o(.text+0x18e): In function `main': > : undefined reference to `NcFile::~NcFile()' > /tmp/ccLrwJsP.o(.text+0x1bc): In function `main': > : undefined reference to `NcVar::get(int*, long, long, long, long, long) > const' > /tmp/ccLrwJsP.o(.text+0x1cf): In function `main': > : undefined reference to `NcFile::~NcFile()' > /tmp/ccLrwJsP.o(.text+0x22d): In function `main': > : undefined reference to `NcFile::~NcFile()' > /tmp/ccLrwJsP.o(.text+0x254): In function `main': > : undefined reference to `NcFile::~NcFile()' > > Howdy! You need to consult your C++ documentation to learn how to use a library with your program. Basically you will need both -I options (to find header files) and -L options, to find the libraries at link time. Take a look here: http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c/Compiling.html#Compiling Also, if you installed netCDF yourself, and ran "make check" then you have already built netCDF C++ programs. Go to examples/CXX and do a "make clean check" to recreate all your C++ example programs. You will want to compile your program with similar command lines. Good luck! Ed Ticket Details =================== Ticket ID: BBC-202504 Department: Support netCDF Priority: Normal Status: Closed