NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: [netcdfgroup] Linking netcdf on AIX with g++ 4.2.0

Tom Kent <Tom.Kent@xxxxxxxx> writes:

> Hello,
> Several of us are stumped and hoping someone can help.
> I'm getting errors linking to netcdf on AIX using g++ 4.2.0. Things
> compile fine, but
> I get undefined errors for ANY use of the classes in netcdfcpp.h
> (NcFile, NcVar, NcDim, etc...)
> To simplify debugging a small test program mimics our errors, so any
> fix to the simple test
> program below most likely will fix our more complex code link elsewhere.....
>
> #include <netcdf.hh>
> int main( int argc, char ** argv )
> {
> NcFile file("out.txt", NcFile::Replace);
> return 0;
> }
>
> compile works fine...
> setenv OBJECT_MODE 32
> g++ -o test.o -g -I/nco/ibm/wx15cp/netcdf32/include -c test.C
> or
> g++ -o test.o -g -fno-for-scope -fno-exceptions -ffriend-injection
> -Wno-write-strings -Wall -DKERNEL_WSIZE=32 -DLINUX_FILES=1
> -DALLOW_2_DIGIT_YEAR -DXT_CODE -DFTN_APPEND_UNDERSCORE -D_REENTRANT
> -I/nco/ibm/wx15cp/netcdf32/include -c test.C
>
> link has errors...
> g++ -v -o test test.o -L/nco/ibm/wx15cp/netcdf32/lib -lnetcdf_c++ -lnetcdf
> or
> g++ -v -o test test.o -L/nco/ibm/wx15cp/netcdf32/lib -lnetcdf -lnetcdf_c++
> gets these errors:
> ld: 0711-317 ERROR: Undefined symbol: .NcFile::NcFile(char const*,
> NcFile::FileMode, unsigned long*, unsigned long, NcFile::FileFormat)
> ld: 0711-317 ERROR: Undefined symbol: .NcFile::~NcFile()
>
> as I mentioned before...
> -exact same undefined errors for use of any of the classes in netcdfcpp.h
> -using g++ 4.2.0 on AIX
> -building 32 bit binary and trying to link to 32 bit netcdf lib....
> -exact same errors using netcdf 3.6.3 as well as 4.0.1
>
> Anyone seen this or conquered it?
> Thanks for any help. It's much appreciated...
>
> Tom

Howdy Tom!

Did you build netCDF from source?

If so, did you run "make check"?

There are C++ tests and examples that are built during make check...

Thanks,

Ed

-- 
Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx



  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: