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.
Greetings Tong, If you need to link to the C++ libs to build your program, you will need to use both linking flags (-lnetcdf_c++ -lnetcdf). Cheers, Sean > I found its root cause. Out IT did not compile/install it. Now it fixed. > > Question about " you will need to add -lnetcdf after -lnetcdf_c++ to your > $(CSU)_LDLIBS flags in order to properly link to the netCDF library": > Is this necessary or optional for us? Please advise > > > > > > > Tong Wei > GOES-R > 240 206 7095 > > > -----Original Message----- > From: Unidata netCDF Support [mailto:address@hidden] > Sent: Tuesday, November 01, 2011 11:24 AM > To: Wei, Tong > Cc: address@hidden > Subject: [netCDF #FWY-763930]: ld: cannot find -lnetcdf_c++ > > Ah, you will need to add the netCDF tools to your path: > > export PATH=/apps/netcdf-4.0.1/bin:$PATH > > Once you've added netCDF to the path, give nc-config another try. > > Cheers, > > Sean > > > Sean, > > > > Thanks. The version of netcdf in our lab is: 4.0.1 > > > > I run this (./nc-config ), it showed: -bash: ./nc-config: No such file or > > directory) > > > > > > > > > > > > Tong Wei > > GOES-R > > 240 206 7095 > > > > > > -----Original Message----- > > From: Unidata netCDF Support [mailto:address@hidden] > > Sent: Tuesday, November 01, 2011 8:11 AM > > To: Wei, Tong > > Cc: address@hidden > > Subject: [netCDF #FWY-763930]: ld: cannot find -lnetcdf_c++ > > > > Greetings Tong, > > > > > Hi , how are you? > > > > > > > We are doing well here in Boulder - getting ready for the next round of > > snow! Woohoo! > > > > > My name is Tong Wei from Harris Corp. > > > > > > We are using netcdf-4.0.1 in our codes. when I was trying to compile this > > > code, I got this error: > > > > > > ld: cannot find -lnetcdf_c++ > > > make: *** [lib/libLightningAlgorithm.so] Error 1 > > > > > > Here is its make file: > > > > > > NETCDF_LOCATION := /apps/netcdf-4.0.1 > > > $(CSU)_CPPFLAGS += -I$(NETCDF_LOCATION)/include > > > $(CSU)_LDFLAGS += -L$(NETCDF_LOCATION)/lib > > > -Wl,-rpath=$(NETCDF_LOCATION)/lib > > > $(CSU)_LDLIBS += -lnetcdf_c++ > > > > > > Then I checked /apps/netcdf-4.0.1, and could not find lnetcdf_c++. Would > > > you please give us some hints on this ? > > > > Ok, if you can't find libnetcdfcd _c++.so within the netcdf lib directory, > > then we have a few problems. In this situation, nc-config is your friend. > > First, let's make sure you are looking in the right place for netCDF: > > > > nc-config --prefix > > > > Now that we know where netCDF lives (or at least the one your account it > > able to see), let's see if it has c++ enabled: > > > > nc-config --has-c++ > > > > Also, you will need to add -lnetcdf after -lnetcdf_c++ to your > > $(CSU)_LDLIBS flags in order to properly link to the netCDF library. > > > > Let me know what you find with nc-config :-) > > > > Cheers, > > > > Sean > > > > > > > > > > thanks. > > > > > > Tong Wei > > > GOES-R > > > 240 206 7095 > > > > > > > > > > > > > > > > > > > > > Ticket Details > > =================== > > Ticket ID: FWY-763930 > > Department: Support netCDF > > Priority: Normal > > Status: Open > > > > > > > Ticket Details > =================== > Ticket ID: FWY-763930 > Department: Support netCDF > Priority: Normal > Status: Open > > Ticket Details =================== Ticket ID: FWY-763930 Department: Support netCDF Priority: Normal Status: Open