Re: [uClinux-dev] Mixing C, C++ causes a linker error

From: David McCullough (davidm@snapgear.com)
Date: Thu Sep 12 2002 - 10:03:02 EDT


Jivin Benny Chen lays it down ...
> Hi Davidm,
> 
> Yeah mate, I am using uC-libc with uclinux-dist-2.4.17 kernel.

What you need to do is ensure that your C++ app is not linked against
uC-libc.  The reason for this is that the C++ libs that come with the
compiler are compiled aginst uClibc and they expect different things.

The easy way is to override LDFLAGS and CFLAGS in the Makefile for you app
so that they do not reference uC-libc and just let the compiler use the
libraries that came with it.

You could also build it outside the uClinux-dist tree with something like:

m68k-elf-g++ -m5307 -msep-data -Wl,-elf2flt -o test test.cpp -lstdc++ -lc -lgcc

Hope that helps,

Cheers,
Davidm


> > Jivin Benny Chen lays it down ...
> > > Thank you for your reply,
> > >
> > > I have made changes to the linker to include the search path that you
> > > specified and also to the C++ src and header files to include extern C.
> I
> > > have managed to get rid of the undefine reference error for __lxstat,
> but i
> > > still get the undefined reference to _stdout error. I am using kernel
> > > version 2.4.10.
> > ...
> >
> > Are you using the uClinux-dist and uC-libc by any chance ?
> >
> > Cheers,
> > Davidm

-- 
David McCullough:    Ph: +61 7 3435 2815  http://www.SnapGear.com
davidm@snapgear.com  Fx: +61 7 3891 3630  Custom Embedded Solutions + Security
This message resent by the uclinux-dev@uclinux.org list server http://www.uClinux.org/


This archive was generated by hypermail 2.1.4 : Thu Sep 19 2002 - 13:21:51 EDT