[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: linking g++ 2.96 object/library in g++ 3.2.2
From: |
Guy Harrison |
Subject: |
Re: linking g++ 2.96 object/library in g++ 3.2.2 |
Date: |
Thu, 22 Jul 2004 23:00:56 GMT |
User-agent: |
KNode/0.7.7 |
WannaLeanOO wrote:
> Hello All,
>
> I have a library build in g++ 2.96, which can be linked with my
> application using g++ 2.96 compiler. However when I use g++ 3.2.2
> (redhat 9) it is not able to resolve many functions.
>
> Am I doing something wrong?
Yes.
> Is this a known issue?
Yes.
> Is there any flag that would help me going?
Nope. No C++ compiler is guaranteed to be compatible with any other C++
compiler that isn't the same version. Unless the docs specifically state
version X is binary compatible with version Y then assume they aren't,
which means you have to rebuild all the C++ components from source.
> To explore futher I wrote a small code as below
> ============================================
> #include <string>
> #include <iostream>
>
> class ErrorTest
> {
> public:
> ErrorTest( int code, std::string errstr ) { }
>
> void print() { std::cout << "Help Help" << std::endl; }
> };
>
> ErrorTest et(1, "str");
>
> int main()
> {
> et.print();
> }
> ==============================================
>
>
> Compiled the code on g++ *2.96* redhat 7.2 (g++ filename.cc)
> and nm -C a.out | grep Err gave the below output
>
> 08049b40 W ErrorTest::ErrorTest(int, basic_string<char,
> string_char_traits<char>, __default_alloc_template<true, 0> >)
> 08049b78 W ErrorTest::print(void)
> ---------------------------------------------
>
> Compiled the same code on g++ *3.2.2* redhat 9 (g++ filename.cc)
> and nm -C a.out | grep Err gave the below output
>
> 080488e6 W ErrorTest::print()
> 080488e0 W ErrorTest::ErrorTest[in-charge](int, std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >)
>
> --------------------------------------------
>
> I think this in-charge is causing the problem... Can somebody please
> throw some light about this in-charge...
That's the 3.2,2 mangled name for that ctor. 2.96 will have generated a
different mangled symbol, hence the link error. You'll have to rebuild the
dependant libs from source (or upgrade packages).