2

I've got a problem here : I have a C++ Library ("DataTsBroad") and a C++ Test app ("DataTsBroadTest"), to test it.
Actually, the Lib and the Test app are both compiled an a Debian Lenny.

Now, i want to continue to compile my Test app on a Debian Lenny (customer constraint), but i would compile my lib on a Squeeze or a Wheezy to work on the last Debian releases.

So, i successfully compiled my Lib on a Squeeze, But, after, when i try to compile my Test app with this Lib on the Lenny, it fails ! There is a Link Error :

Linking CXX executable DataTsBroadTest /home/nis/pezierg/test/ProductMak/Export/DataTsBroad/L64/Release/libDataTsBroad64.so: undefined reference to `std::ctype::_M_widen_init() const@GLIBCXX_3.4.11'
collect2: ld returned 1 exit status
make[2]: *** [DataTsBroadTest] Error 1
make[1]: *** [CMakeFiles/DataTsBroadTest.dir/all] Error 2
make: *** [all] Error 2

The problem is certainly due to ostream C++ Lib, I tried to comment all it's uses in my Lib and it works.

But how can i really fix the problem ?

PEZ
  • 21
  • 1
  • Questions about **programming** should be asked on our sister site [so]. Your question was not migrated because it [needs improvement](http://meta.stackexchange.com/q/156810/189912) first. – Michael Hampton Nov 08 '13 at 16:08

1 Answers1

0

I think the problem might be differing versions of gcc/g++ on Lenny and Squeeze. Try to make them equal, either upgrade one or downgrade the other, and then try again.

replay
  • 3,240
  • 14
  • 17
  • In Fact, g++ version is the problem, i can't downgrade it because i want to use the lastest version ! What can i change in the code to fix it ? – PEZ Nov 08 '13 at 10:38
  • I think possibly you could avoid the problem by not using any C++ libraries, but only C libraries, because they change less often for basic functions like input/output streams. So instead of using an ostream, just `#include ` and use `printf()`. I'm aware of the fact that this is not optimal, but I think otherwise you'll have to change the g++ versions. – replay Nov 08 '13 at 10:43
  • btw. changing the g++ versions doesn't necessarily mean that you need root on the system (in case that's the problem), you can also compile an alternate version of g++ as user and use it, without modifying the system's g++. – replay Nov 08 '13 at 10:45
  • For G++, i'm really forced to use existing versions. OK for stdio.h, but if i do that, i have to rewrite a really huge part of my code ! The management of Types is really convenient in C++. If i have to use printf (or fprintf to replace ofstream) i must be careful about all the %d, %c etc... and i will have to totally write new classes to do this. It's really the only one solution ? – PEZ Nov 08 '13 at 11:05
  • @PEZ Otherwise, compile your own g++ that matches the "older" server and use that to compile your app. The issue is an incompatibility of versions. – Nathan C Nov 08 '13 at 12:15