Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined reference gcc cxa

Tags:

c++

gcc

linker

I'm trying to compile a program with make, but I get stuck on a error raised (see below) :

gcc -Wall -g -O2 -I. -I../include -I/usr/include/libxml2/ -I/usr/include/x86_64-linux-gnu/ -I/usr/include/geotiff/ -I/usr/local/hdf4/hdf-4.2.11/hdf4/include/ -I/usr/local/hdf-eos/hdfeos/include/ -I -I -o convert_lpgs_to_espa convert_lpgs_to_espa.o -L../lib -l_espa_format_conversion -l_espa_raw_binary -l_espa_common -L/usr/lib/x86_64-linux-gnu/ -lxml2 -L/usr/lib/ -lgeotiff -L/usr/lib/x86_64-linux-gnu/ -ltiff -L/usr/lib/x86_64-linux-gnu/ -ljpeg -L -ljbig -L/usr/local/hdf-eos/hdfeos/hdfeos2/lib -lgctp -L -lz -lm 
/usr/lib/x86_64-linux-gnu/libicuuc.so.52: référence indéfinie vers « __cxa_throw_bad_array_new_length@CXXABI_1.3.8 »
collect2: error: ld returned 1 exit status
Makefile:95: recipe for target 'convert_lpgs_to_espa' failed
make[1]: *** [convert_lpgs_to_espa] Error 1
make[1]: Leaving directory '/project/$folders$/tools'
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 2

Following this close question : program linking fails when using custom built gcc, I purge and reinstall libstdc++-4.9-dev.

I'm running Ubuntu 15.04 with gcc (Ubuntu 4.9.2-10ubuntu13) 4.9.2

How can I resolve this issue ?

like image 614
Nicolas Matton Avatar asked Feb 26 '26 12:02

Nicolas Matton


1 Answers

It's because you link using gcc instead of g++. The difference is that the g++ command adds the C++ runtime library when linking.

You can either change from using gcc to g++, or manually link with the C++ runtme library by adding -lstdc++.

like image 136
Some programmer dude Avatar answered Feb 28 '26 00:02

Some programmer dude



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!