Problem linking in a GNU C++ lib with Sun compiler

Rupert Wood me@rupey.net
Tue Oct 16 10:45:00 GMT 2001


Frank Geck wrote:

> I'm having a problem compiling using the Sun workshop compiler when
> linking in a library that was compiled using GNU g++.   I'm getting
> undefined symbols for most everything that I call in that library
> from my program.  My thought is that it has to do with name mangling
> differences between the compilers but I'm not sure and I don't know
> how to fix it.  Any thoughts?

You're right - it's because the names will be mangled differently. But
this serves a purpose: the C++ calling conventions used by both
compilers may be different (so even if they did link they may not be
able to invoke/return properly).

There's no easy way to fix this without switching both the library and
your program to the same compiler.

Rup.



More information about the Gcc-help mailing list