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.
Camilla > Really thank you for your help. However, there are some more undefined > references displayed. Are there anything missing? Also, as for the links for > the library and include files, can I set them as system environment > variables in my .bashrc file? The errors you are getting, such as > /lib/libnetcdf_c++.a(netcdf.o): In function > `_ZNK16NcTypedComponent9get_spaceEl': > /home/koshiro/netcdf-3.6.2/cxx/netcdf.cpp:563: undefined reference to > `___gxx_personality_sj0' > /home/koshiro/netcdf-3.6.2/cxx/netcdf.cpp:563: undefined reference to > `__Unwind_SjLj_Register' > /home/koshiro/netcdf-3.6.2/cxx/netcdf.cpp:586: undefined reference to > `__Unwind_SjLj_Unregister' are not related to netCDF, but to something wrong with the way you are trying to compile and link your program. You can google the phrase undefined reference to ___gxx_personality_sj0 to see what I mean about not being related to netCDF. You would get similar errors if you used gcc instead of g++, or if you used a different C++ compiler than what you used to build the library in cygwin. You might also get these errors if you didn't install everything needed for g++ development in your cygwin environment. If you have built the 4.1.1 version of the library, you might see how the C++ examples are compiled and linked, and follow that pattern. Unfortunately the examples are compiled and linked before the libraries are installed, so the compiling and linking flags use a complicated utility named "libtool" and get the libraries from directories where they were first built. Another thing you could try is the 4.1.1 version of the "nc-config" utility, to show how the library flags need to appear on the link line. For example, if your netCDF utilities are installed in /usr/local/lib/bin, you could run /usr/local/lib/bin/nc-config --libs and it would show the options for specifying library directories and libraries in the right order. However, there might still be extra C++ runtime libraries that you would need to specify to your C++ compiler, if it wasn't installed to know where those are, such as "-lg++". And you must be using the same g++ compiler you used to create the libnetcdf_c++ library, to get the "name mangling" right. I don't know much more about the C++ netCDF library, so I hope this helps. --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: ZDR-128646 Department: Support netCDF Priority: Normal Status: Closed