[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: gcc-3.x and C programs with some C++ objects linked in

On Thu, Sep 12, 2002 at 06:26:56PM +0200, Mario Lang wrote:
> Hey.
> I'm having a bit of a problem here.  brltty is a C program,
> but some of it's code is written in C++.  Until gcc-2.95 it
> was perfectly possible to compile the .cc files with g++ into .o files,
> and link the whole program with gcc into a binary which did not
> dynamicly link against libstdc++.
> In gcc-3.x, this appears to no longer work.  I tried compiling
> the c++ code with -fno-exceptions, and link it together with gcc, but
> I always get a bunch of unresolved symbols.
> If I link with g++, it works, but I get a binary which looks like this:
> lexx:~/tmp/c/brltty-3.1% ldd Programs/brltty
>         libdl.so.2 => /lib/libdl.so.2 (0x4001e000)
>         libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 (0x40021000)
>         libm.so.6 => /lib/libm.so.6 (0x4006a000)
>         libc.so.6 => /lib/libc.so.6 (0x4008b000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> It used to be like this with gcc-2.95:
> lexx:~/tmp/c/brltty-3.1% ldd /sbin/brltty
>         libdl.so.2 => /lib/libdl.so.2 (0x4001e000)
>         libm.so.6 => /lib/libm.so.6 (0x40021000)
>         libc.so.6 => /lib/libc.so.6 (0x40042000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> Does anyone have an idea why this is no longer working, and if
> there is a way to circumvent the problem?

Try adding '-lsupc++' to your link command and linking with GCC again?

Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

Reply to: