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.
Vanesa, > I need this version, with version 4.1.1 I have no problems, but I need to > install wrf and they recommend version 3.6.2 netcdf. > I add de include, and works well until make, when I get this... > > if c++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../../fortran -I../../cxx > -I../../libsrc -g -O2 -MT sfc_pres_temp_rd.o -MD -MP -MF "$depbase.Tpo" -c -o > sfc_pres_temp_rd.o sfc_pres_temp_rd.cpp; \ > then mv -f "$depbase.Tpo" "$depbase.Po"; else rm -f "$depbase.Tpo"; exit 1; fi > sfc_pres_temp_rd.cpp: In function ‘int main()’: > sfc_pres_temp_rd.cpp:123: error: ‘strlen’ was not declared in this scope > sfc_pres_temp_rd.cpp:123: error: ‘strncmp’ was not declared in this scope > sfc_pres_temp_rd.cpp:133: error: ‘strlen’ was not declared in this scope > sfc_pres_temp_rd.cpp:133: error: ‘strncmp’ was not declared in this scope > sfc_pres_temp_rd.cpp:141: error: ‘strlen’ was not declared in this scope > sfc_pres_temp_rd.cpp:141: error: ‘strncmp’ was not declared in this scope > sfc_pres_temp_rd.cpp:149: error: ‘strlen’ was not declared in this scope > sfc_pres_temp_rd.cpp:149: error: ‘strncmp’ was not declared in this scope > make[3]: *** [sfc_pres_temp_rd.o] Error 1 > make[3]: se sale del directorio `/home/cbarca/netcdf-3.6.2/examples/CXX' > make[2]: *** [check-am] Error 2 > make[2]: se sale del directorio `/home/cbarca/netcdf-3.6.2/examples/CXX' > make[1]: *** [check-recursive] Error 1 > make[1]: se sale del directorio `/home/cbarca/netcdf-3.6.2/examples' > mamples It looks like you could fix this by adding #include <cstring> in the include statements at the begiining of the sfc_pres_temp_rd.cpp file. You will probably need to add this also to the other example files in that directory to get a successful make, testing all the examples. These problems were fixed in later versions. > Then I tried > $ export CXX='' > > And I get the same error. After setting CXX='', you would have to run "make clean" and rerun the configure script, before running "make check". Doing things in that order, you should not have gotten any C++ errors. But it sounds like you're close to getting the C++ API and examples to work anyway, so you might as well finish with that approach. By the way, even though WRF recommends using version 3.6.2, I expect it would work fine linking against 4.1.1 also. We know there are users using WRF with 4.1.1 successfully ... --Russ ________________________________ > De: Unidata netCDF Support <address@hidden> > Para: address@hidden > CC: address@hidden > Enviado: jueves, 1 de julio, 2010 18:26:05 > Asunto: [netCDF #STU-162362]: Netcdf with intel compilers > > Hi Vanesa, > > > HI: I´m trying to install netcdf 3.6.2 using intel compilers. > > I follow the instructions in Building > > NetCDF* with the Intel® Compilers > > > > 1) > > cbarca@debian:/opt/intel/Compiler/11.1/072/bin/ia32$ source > > /opt/intel/Compiler/11.1/072/bin/ia32/iccvars_ia32.sh > > cbarca@debian:/opt/intel/Compiler/11.1/072/bin/ia32$ source > > /opt/intel/Compiler/11.1/072/bin/ia32/ifortvars_ia32.sh > > > > 2) > > $ cd <work directory> > > $ tar -xvzf netcdf-3.6.2.tar.gz > > > > 3) > > $ export CC=icc > > $ export CXX=icpc > > $ export CFLAGS='-O3 -xT -ip > > -no-prec-div -static' > > $ export CXXFLAGS='-O3 -xT -ip > > -no-prec-div -static' > > > > $ export F77=ifort > > $ export FC=ifort > > $ export F90=ifort > > $ export FFLAGS='-O3 -xT -ip > > -no-prec-div -static' > > > > $ export CPP='icc -E' $ export > > CXXCPP='icpc -E' > > > > 4)sudo ./configure --prefix=/usr/local/netcdf > > > > 5) sudo make > > > > And I get this error: > > > > ncvalues.cpp: In member function 'virtual char* > > NcValues_ncbyte::as_string(long int) const': > > ncvalues.cpp:238: error: 'strncpy' was not declared in this scope > > ncvalues.cpp: In member function 'virtual char* > > NcValues_char::as_string(long int) const': > > ncvalues.cpp:246: error: 'strncpy' was not declared in this scope > > make[2]: *** [ncvalues.lo] Error 1 > > make[1]: *** [all-recursive] Error 1 > > make: *** [all] Error 2 > > > > I'm missing something? > > Version 3.6.2 of netCDF, from 2007, had a bug in the C++ interface, > the file cxx/ncvalues.cpp was missing the statement > > #include <cstring> > > after > > #include <string> > > near the beginning of the file. So one workaround would be to edit > that file by inserting that statement, and then continue running the > "make all check" to see if it completes successfully. > > An alternative would be to just use a newer version of netCDF with > this bug (and others) fixed. I recommend just getting the latest > netCDF source distribution (4.1.1) and building/installing from that. > If you specify --disable-netcdf-4 as an option to configure, it will > just build the netCDF-3 libraries and executables, so you won't have > to install HDF5. You can also specify --disable-dap if you don't > need remote access via OPeNDAP to data on remote servers. If you use > version 4.1.1, you can continue to use the same flag settings you are > using for 3.6.2. > > Another alternative would be to just not build the C++ interface, > which is not used by the other netCDF utilities such as ncdump and > ncgen. This is accomplished by running the configure script again > after specifying > > $ export CXX='' > > along with the other settings you are using. > > --Russ > > Russ Rew UCAR Unidata Program > address@hidden http://www.unidata.ucar.edu > > > > Ticket Details > =================== > Ticket ID: STU-162362 > Department: Support netCDF > Priority: Normal > Status: Closed > > > > Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: STU-162362 Department: Support netCDF Priority: Normal Status: Closed