> Date: Thu, 1 Jul 1999 12:58:57 -0400
> From: Gregory Orris <orris@xxxxxxxxxxxxxxxxxx>
> To: netcdfgroup@xxxxxxxxxxxxxxxx
> Subject: C++ interface problems
In the above message, Gregory Orris <orris@xxxxxxxxxxxxxxxxxx> wrote:
> Currently I'm trying to use the libnetcdf_c++.a interface in a fairly
> simple program on an SGI OCTANE running IRIX 6.5.3. While everything
> has been compiled and the tests check out fine, a bug has cropped up that
> is inexplicable: The following lines of code
>
> cerr << "Is it valid? " << output_file.is_valid() << endl;
> cerr << "What is the id? " << output_file.id() << endl;
> cerr << "Is Latitude valid? " << output_file.get_var("Latitude")->is_valid()
> << endl;
>
> elicits the following output
>
> Is it valid? 1
> What is the id? 3
> ncvarid: ncid 3: Not a netCDF id
I'm unable to duplicate the problem. On an IRIX 6.5 system using
CC=/bin/c89
CFLAGS=-g
CXX=/bin/CC
using the MIPSpro compilers version 7.2.1.3m.
I compile and run the appended C++ program (stored in a file named
"bug1.cc") from the netcdf-3.4/src/cxx/ directory after running "make
test", so it reads the "example.nc" file created in testing.
$ CC -o bug1 -I../libsrc -I. -DNDEBUG bug1.cc libnetcdf_c++.a -L../libsrc
-lnetcdf
$ ./bug1
Is it valid? 1
What is the id? 3
Is lat valid? 1
The output shown above is what is expected. Can you send more details
to "support@xxxxxxxxxxxxxxxx" so we can reproduce the problem?
Thanks!
--Russ
#include "netcdf.hh"
int
main()
{
NcFile nfile("example.nc", NcFile::ReadOnly);
cerr << "Is it valid? " << nfile.is_valid() << endl;
cerr << "What is the id? " << nfile.id() << endl;
cerr << "Is lat valid? " << nfile.get_var("lat")->is_valid() << endl;
}