|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Compiling C++ code with NetCDF libraries: "undefined reference"
Hi!
I am trying to compile a C++ code with cmake and gcc on Ubuntu. The code uses NetCDF4 libraries. I specify the path to these libraries as follows: -I/usr/local/include -L/usr/local/lib -lnetcdf -lnetcdf_c++4 "ccmake" and "cmake" work fine. After typing "make" I receive the error message: Linking CXX executable guess CMakeFiles/guess.dir/modules/guessio_daily_netCDF.cpp.o: In function `getYearlyRecord(Coord, double*, xtring, int)': guessio_daily_netCDF.cpp .text+0x8309): undefined reference to `netCDF::NcFile::NcFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, netCDF::NcFile::FileMode)'(...) I receive the same message when I specify the path to my NetCDF4 libraries with a not-existing path (e.g. -I/blablabla/include ...). As I understand, the linker does not find my NetCDF libraries, correct? Do you have any suggestions on how to solve this problem? In case it helps, below I include the paths of all my netcdf libraries. The libraries were built with the same compiler (gcc). Thank you very much in advance! Cheers, Chris /usr/share/man/man3/netcdf.3.gz /usr/share/man/man3/netcdf_f77.3.gz /usr/share/man/man3/netcdf_f90.3f90.gz /usr/share/doc/netcdf-bin /usr/share/doc/libnetcdf-dev /usr/share/doc/libnetcdf6 /usr/share/mime/application/x-netcdf.xml /usr/lib/libnetcdf_c++.so /usr/lib/libnetcdff.so /usr/lib/libnetcdf.a /usr/lib/netcdf.pc /usr/lib/pkgconfig/netcdf.pc /usr/lib/libnetcdf.so.6.0.0 /usr/lib/libnetcdff.so.5.0.0 /usr/lib/libnetcdf.so.6 /usr/lib/libnetcdf_c++.so.5 /usr/lib/libnetcdf.so /usr/lib/libnetcdf_c++.a /usr/lib/libnetcdff.so.5 /usr/lib/libnetcdff.a /usr/lib/libnetcdf_c++.so.5.0.0 /usr/include/netcdf.mod /usr/include/netcdf.h /usr/include/hdf/hdf2netcdf.h /usr/include/hdf/hdf4_netcdf.h /usr/include/netcdf.hh /usr/include/netcdf.inc /usr/include/netcdfcpp.h /usr/local/lib/libnetcdf_c++4.la /usr/local/lib/pkgconfig/netcdf-cxx4.pc /usr/local/lib/libnetcdf_c++4.so /usr/local/lib/libnetcdf_c++4.so.1.0.2 /usr/local/lib/libnetcdf_c++4.a /usr/local/lib/ncarg/data/cdf/sst30e_netcdf.nc /usr/local/lib/ncarg/data/cdf/sstdata_netcdf.nc /usr/local/lib/libnetcdf_c++4.so.1 /usr/local/include/netcdf |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Perl error: Can't call method "value" on an undefined value | vpundit | Emergency UNIX and Linux Support !! Help Me!! | 2 | 07-21-2012 05:00 PM |
| I got "undefined reference to" on gcc | sluge | Solaris | 0 | 07-09-2012 04:57 AM |
| make fails with "undefined reference to..." | crimso | Programming | 6 | 10-19-2011 10:03 AM |
| Getting error "Undefined symbol: .u_strlen_2_6" | nachiketv | AIX | 0 | 06-05-2006 09:16 AM |
| shared object "undefined symbol: fstat" error | marcus121 | Programming | 5 | 04-24-2006 07:11 PM |
|
|