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.
>To: address@hidden >From: Pedro Diegues <address@hidden> >Subject: Problems compiling netcdf3.3.1 >Organization: ICAT, Faculty of Sciences, University Of Lisbon >Keywords: 199711251804.LAA12967 Hi, > I am having problems with the compilation of netcdf using the c++ > interface. I have gather all the info you might need (i hope). > > My compilers are Fortran ver. 4.0 and C/C++ ver 4.2. > > VERSION > 3.3.1 > uname -a > SunOS Meteosun 5.5.1 Generic sun4u sparc SUNW,Ultra-1 > f77 is /opt/SUNWspro/bin/f77 > cc is a tracked alias for /opt/SUNWspro/bin/cc > CC is /opt/SUNWspro/bin/CC We have tested netCDF version 3.3.1 under SunOS 5.6 and SunOS 5.5.1 earlier using these versions of the compilers, and cannot duplicate the link errors you are seeing: > Undefined first referenced > symbol in file > __0fOunsafe_ostreamHdo_opfxv libnetcdf_c++.a(ncvalues.o) > cout nctst.o > __0OnwUi libnetcdf_c++.a(netcdf.o) > ... Have you successfully compiled, linked, and run any other C++ programs with this compiler? There may be a problem in the way it was installed, because the list of unsatisfied externals include "cout" which is just the standard output stream that should be defined by including <stream.h>. Can you compile, link, and run the following two-line C++ program successfully? #include <stream.h> main() {cout << "Hello, world\n";} If not, then try to get that to work first, before installing and testing the C++ interface. If that doesn't solve the problem, we will need a little more information: 1. The output from running the "configure" script. To get this, go to the netcdf-3.3.1/src/ directory and invoke the following commands: rm config.cache ./configure > configure.out then send the contents of the "configure.out" file. For comparison, I've appended the output we get on our SunOS 5.6 system. 2. The output from trying to compile the C++ interface. To get this, go to the netcdf-3.3.1/src/cxx/ directory and invoke the following command: make clean all test > make.out and send the contents of the make.out file. Again, for comparison I've appended what we get. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu ------- output from configure script under SunOS 5.6 ---------- creating cache ./config.cache checking for m4... m4 checking for xlc... no checking for c89... c89 checking C compiler... works checking how to make dependencies... cc -xM checking for CC... CC checking C++ compiler "CC"... works checking how to run the C preprocessor... c89 -E checking for f77... f77 checking for FORTRAN .F compiler... checking if FORTRAN compiler handles *.F files... yes checking for C-equivalent to FORTRAN routine "SUB"... sub_ checking for FORTRAN "byte"... yes checking for FORTRAN "integer*2"... yes checking if FORTRAN "byte" is C "signed char"... yes checking if FORTRAN "byte" is C "short"... no checking if FORTRAN "byte" is C "int"... no checking if FORTRAN "integer*2" is C "short"... yes checking if FORTRAN "integer*2" is C "int"... no checking if FORTRAN "integer" is C "int"... yes checking if FORTRAN "real" is C "float"... yes checking if FORTRAN "doubleprecision" is C "double"... yes checking for FORTRAN-equivalent to netCDF "byte"... byte checking for FORTRAN-equivalent to netCDF "short"... integer*2 checking for math library checking for -lc... no checking for -lm... yes checking for ar... ar checking for ranlib... ranlib checking for stdlib.h... yes checking for sys/types.h... yes checking for strerror... yes checking for ftruncate... yes checking for st_blksize in struct stat... yes checking whether cross-compiling... no checking for IEEE floating point format... yes checking for ANSI C header files... yes checking for size_t... yes checking for off_t... yes checking for ssize_t... yes checking for ptrdiff_t... yes checking for uchar... no checking whether char is unsigned... no checking whether byte ordering is bigendian... yes checking size of short... 2 checking size of int... 4 checking size of long... 4 checking size of float... 4 checking size of double... 8 checking size of off_t... 4 checking size of size_t... 4 checking for catman... catman checking for manual-page index command... catman -w -M $(MANDIR) checking binary distribution directory... /home/ftp/pub/binary/sunos_5.6-sparc updating cache ./config.cache creating ./config.status creating macros.make udcreating fortran/nfconfig.inc fortran/nfconfig.inc is unchanged creating libsrc/ncconfig.h libsrc/ncconfig.h is unchanged ------- output from "make clean all test" in cxx directory under SunOS 5.6 ---------- rm -f *.o *.a *.so *.sl *.i *.Z core nctst test.out example.nc *.cps *.dvi *.fns *.log *~ *.gs *.aux *.cp *.fn *.ky *.pg *.toc *.tp *.vr CC -c -O -I../libsrc -DNDEBUG netcdf.cc CC -c -O -I../libsrc -DNDEBUG ncvalues.cc ar cru libnetcdf_c++.a netcdf.o ncvalues.o ranlib libnetcdf_c++.a CC -c -O -I../libsrc -DNDEBUG nctst.cc CC -o nctst -I../libsrc -DNDEBUG -O nctst.o libnetcdf_c++.a -L../libsrc -lnetcdf ./nctst > test.out *** C++ test successful ***