[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDF #BBC-202504]: netCDF General - Compiling Small C++ program
- Subject: [netCDF #BBC-202504]: netCDF General - Compiling Small C++ program
- Date: Mon, 09 Jul 2007 16:53:22 -0600
> That almost worked!
>
> Now I have more interesting errors. I think this is something with object
> files.
>
> [ltharri1@coiti282 cxx]$ g++ -I/home/ltharri1/Desktop/netcdf-3.6.2/libsrc
> oldconversion.cpp
> /tmp/ccLrwJsP.o(.text+0x131): In function `main':
> : undefined reference to `NcFile::NcFile(char const*, NcFile::FileMode,
> unsigned int*, unsigned int, NcFile::FileFormat)'
> /tmp/ccLrwJsP.o(.text+0x140): In function `main':
> : undefined reference to `NcFile::is_valid() const'
> /tmp/ccLrwJsP.o(.text+0x153): In function `main':
> : undefined reference to `NcFile::~NcFile()'
> /tmp/ccLrwJsP.o(.text+0x176): In function `main':
> : undefined reference to `NcFile::get_var(char const*) const'
> /tmp/ccLrwJsP.o(.text+0x18e): In function `main':
> : undefined reference to `NcFile::~NcFile()'
> /tmp/ccLrwJsP.o(.text+0x1bc): In function `main':
> : undefined reference to `NcVar::get(int*, long, long, long, long, long)
> const'
> /tmp/ccLrwJsP.o(.text+0x1cf): In function `main':
> : undefined reference to `NcFile::~NcFile()'
> /tmp/ccLrwJsP.o(.text+0x22d): In function `main':
> : undefined reference to `NcFile::~NcFile()'
> /tmp/ccLrwJsP.o(.text+0x254): In function `main':
> : undefined reference to `NcFile::~NcFile()'
>
>
Howdy!
You need to consult your C++ documentation to learn how to use a
library with your program.
Basically you will need both -I options (to find header files) and -L
options, to find the libraries at link time.
Take a look here:
http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c/Compiling.html#Compiling
Also, if you installed netCDF yourself, and ran "make check" then you
have already built netCDF C++ programs. Go to examples/CXX and do a
"make clean check" to recreate all your C++ example programs. You will
want to compile your program with similar command lines.
Good luck!
Ed
Ticket Details
===================
Ticket ID: BBC-202504
Department: Support netCDF
Priority: Normal
Status: Closed