Sponsored Content
Top Forums Programming Compiling C++ code with NetCDF libraries: "undefined reference" Post 302704385 by Alauda on Friday 21st of September 2012 01:26:24 PM
Old 09-21-2012
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.cppSmilie.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
 

10 More Discussions You Might Find Interesting

1. Programming

shared object "undefined symbol: fstat" error

Didn't have this problem in AIX, but ported to Linux with GCC compiler and am now getting a runtime error: tssutil: symbol lookup error: /work/agility/devel/bin/libagam.so: undefined symbol: fstat I'm sure most of you know that fstat is an intrinsic function just like printf, memcpy, etc. When I... (5 Replies)
Discussion started by: marcus121
5 Replies

2. AIX

Getting error "Undefined symbol: .u_strlen_2_6"

Hi, I am using xlC compiler. The compilation goes fine but at the time of linking it gives the following error ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. ld: 0711-317 ERROR: Undefined symbol: .u_strlen_2_6 ld: 0711-317 ERROR: Undefined symbol:... (0 Replies)
Discussion started by: nachiketv
0 Replies

3. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

4. Shell Programming and Scripting

bash: "undefined variable" and pipe

Hi, haven't found anything about this through searching, so may be a new topic: when doing this: set -o nounset set -o errexit find . -name "*.lib" | while read library; do echo ${libary} done echo "after while" I expect the script to exit within the while loop (because of nounset and... (6 Replies)
Discussion started by: nagaidhlig
6 Replies

5. Shell Programming and Scripting

Undefined "n" value and simplifying script

I have a very 'dirty' bash script that is working and looks like this: #!/bin/bash for i in {1..n} do mv block${i} infile ./dnadist <<-EOF D Y EOF rm infile mv outfile Result${i} mv Result${i} infile ./neighbor <<-EOF Y EOF rm infile rm outfile mv outtree Result${i}... (8 Replies)
Discussion started by: Xterra
8 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Programming

make fails with "undefined reference to..."

i am compiling a program called vasp on suse and get the following error. there are many more preprocess and ifort commands prior so i just grabbed the tail of the log file: ./preprocess <main.F | /usr/bin/cpp -P -C -traditional >main.f90 -DMPI -DHOST=\"LinuxIFC\" -DIFC -Dkind8 -DNGZhalf... (6 Replies)
Discussion started by: crimso
6 Replies

8. Solaris

I got "undefined reference to" on gcc

Hell all I tryed to build rmp from sources on Solaris 10. I download source code, install gcc, binutils, and other packs с sunfreeware.com. Doring compilation I got an error: /bin/bash ./libtool --tag=CC --mode=link gcc -std=gnu99 -g -O2 -fPIC -DPIC -D_REENTRANT -Wall... (0 Replies)
Discussion started by: sluge
0 Replies

9. Emergency UNIX and Linux Support

Perl error: Can't call method "value" on an undefined value

Hi, I am running a perl script to automate a process and I keep running into a error can't find the "value" Can't call method "value" on an undefined value at process_file.pl line 44. file is CVS cell is ifdfdxrfmp.ksh Here is the script I have also attached it as well: ... (2 Replies)
Discussion started by: vpundit
2 Replies

10. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
libplot(3LIB)							Interface Libraries						     libplot(3LIB)

NAME
libplot, lib300, lib300s, lib4014, lib450, libvt0 - graphics interface libraries SYNOPSIS
cc [ flag... ] file... -lplot [ library... ] #include <plot.h> DESCRIPTION
Functions in this library generate graphics output. INTERFACES
The shared object libplot.so.1 provides the public interfaces defined below. See intro(3) for additional information on shared object interfaces. arc box circle closepl closevt cont erase label line linemod move openpl openvt point space FILES
/usr/lib/libplot.so.1 shared object /usr/lib/64/libplot.so.1 64-bit shared object /usr/lib/lib300.so.1 shared object /usr/lib/64/lib300.so.1 64-bit shared object /usr/lib/lib300s.so.1 shared object /usr/lib/64/lib300s.so.1 64-bit shared object /usr/lib/lib4014.so.1 shared object /usr/lib/64/lib4014.so.1 64-bit shared object /usr/lib/lib450.so.1 shared object /usr/lib/64/lib450.so.1 64-bit shared object /usr/lib/libvt0.so.1 shared object /usr/lib/64/libvt0.so.1 64-bit shared object ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsl (32-bit) | +-----------------------------+-----------------------------+ | |SUNWcslx (64-bit) | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
pvs(1), intro(3), attributes(5) SunOS 5.10 13 Jun 2003 libplot(3LIB)
All times are GMT -4. The time now is 08:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy