[NetCDF] - Error encountered when creating a "NcFile" object
Hanson, Kurt
khanson at wsi.com
Tue Nov 7 12:41:29 MST 2006
Alion --
Without seeing the command line(s) used to compile and link your code,
I'd have to guess that you're missing one or more of the options:
-L/your/netcdf/lib -lnetcdf_c++ -lnetcdf
in the link step, where you should replace /your/netcdf/lib with the
directory containing the libnetcdf_c++.a and libnetcdf.a libraries. This
certainly applies to builds using GNU gcc (in this case, g++ for
compiling), and probably also applies to other compilers too.
If that doesn't help, I suggest you pass along the compile and link
command lines you're using.
Regards --
Kurt Hanson
WSI Corporation
-----Original Message-----
From: owner-netcdfgroup at unidata.ucar.edu
[mailto:owner-netcdfgroup at unidata.ucar.edu]On Behalf Of Alion Sci
Sent: Tuesday, November 07, 2006 1:13 PM
To: Netcdf group
Subject: [NetCDF] - Error encountered when creating a "NcFile" object
Ok, this is what my code snippet looks like:
-------------------------------------------------------------------------
-------------------------------------------------------------------------
----
This shows the details of one of my constructors. It is located in
DatatSet.cc,
it has a corresponding headerfile in DataSet.h and my executable is
called 'datatest'.
/** Constructor #1 */
DataSet::DataSet( const char* fileName ) {
NcFile coreData(filename, NcFile::Replace);
.
.
.
// end of constructor
}
-------------------------------------------------------------------------
-------------------------------------------------------------------------
----
Now, the problem is that when I get to the 3rd line of code [ NcFile
coreData(filename, NcFile::Replace); ] the compiler goes nuts and gives
me the following error:
-------------------------------------------------------------------------
-------------------------------------------------------------------------
----
DataGrid.o: In function
`DataGrid':/home/jstoup/WORK/trunk/DataGrid.cc:37: undefined reference
to `NcFile::NcFile(char const*, NcFile::FileMode, unsigned int*,
unsigned int, NcFile::FileFormat)'
:/home/jstoup/WORK/trunk/DataGrid.cc:37: undefined reference to
`NcFile::~NcFile()'
:/home/jstoup/WORK/trunk/DataGrid.cc:37: undefined reference to
`NcFile::NcFile(char const*, NcFile::FileMode, unsigned int*, unsigned
int, NcFile::FileFormat)'
:/home/jstoup/WORK/trunk/DataGrid.cc:37: undefined reference to
`NcFile::~NcFile()'
collect2: ld returned 1 exit status
make: *** [dataset_test] Error 1
-------------------------------------------------------------------------
-------------------------------------------------------------------------
----
Anyone have an idea as to why I am getting this linker error?
help would be cool,
thanks
AlionSci
More information about the netcdfgroup
mailing list