rook
rook

Reputation: 6240

GCC "undefined reference to" but symbols exist

Can I use shared libraries created by different versions of GCC and how?

I have undefined reference to errors while linking. But these names exist in the so libraries. I figured out that libs were built with older GCC version (2.8), I'm using current GCC version (4.7) and thus it seems that names are mangled differently:

Built by GCC 2.8.1:

setInfo__10SS7_HeaderUl

Built by GCC 4.7.2:

_ZN10SS7_Header7setInfoEm

and can't be resolved (right?).

Is there any way to use old shared libraries without rebuilding them? (Maybe I can recompile existing code using some backward compatibility flags, etc, to suit old libraries)

Upvotes: 1

Views: 360

Answers (1)

Employed Russian
Employed Russian

Reputation: 213375

Is there any way to use old shared libraries without rebuilding them?

No: gcc-2.x and 3.x are not ABI-compatible.

If you somehow managed to fix the mangling, you'd just get a crash because the object layout is completely different. The mangling was changed precisely to save you the trouble of debugging runtime crashes that would be very hard to understand.

Upvotes: 1

Related Questions