C++ for embedded systems

angelo angelo at hunterlink.net.au
Fri Oct 13 01:56:02 UTC 2000


Cool, I just added the following inside my project makefile

LINK_LIBS += -lstdc++
 and it worked fine

Thanks

Nick.SIMON at syntegra.bt.co.uk wrote:

> I had this problem with powerPC 860.  Ralf Corsepius sent:
>
> >
> > I guess your problem is originating from the make-exe rule in your
> > make/custom/<BSP>.cfg.
> >
> > There is a known (and still unfixed) problem with the general
> > working principle of make-exe and c++, which for some strange reason
> > only shows with some permutations of multilib flags for some
> > targets.
> > You might try to add -lstdc++ to the make-exe rule in your <BSP>.cfg
> > (cf. make/custom/gensh2.cfg - the sh2 is known to suffer from this
> > problem).
> >
>
> which worked for me.
>
> Best of luck,
>
> -- Nick Simon
>
> > -----Original Message-----
> > From: angelo [mailto:angelo at hunterlink.net.au]
> > Sent: 11 October 2000 01:50
> > Cc: rtems-users at oarcorp.com
> > Subject: Re: C++ for embedded systems
> >
> >
> > I seem to be having the problem also that I am not linking
> > with the standard
> > C++ libraries also.
> >
> > for the following file, I get the link error following.  What
> > must be done to
> > solve this?
> >
> > #include <iostream>
> > #include <fstream>
> >
> > int x ()
> > {
> >   ifstream testfile ("testfile");
> >   if (testfile)
> >     {
> >       cout <<"testfile opened"<<endl;
> >       testfile.close();
> >     }
> >   else
> >   {
> >     cout<<"unable to open file"<<endl;
> >   }
> >
> >   return 1;
> > }
> >
> > *************************************************************
> > Error message
> > *************************************************************
> >
> > /opt/rtems/bin/i386-rtems-gcc --pipe -B/opt/rtems//pc386/lib/
> > -specs bsp_specs
> > -
> > qrtems -g -Wall -ansi -fasm  -O4           -L /opt/rtems//pc386/lib
> > -Wl,-Ttex
> > t,0x00100000 -o o-optimize/smart.obj   o-optimize/mainline.o
> > o-optimize/testcpp.
> > o  /opt/rtems//pc386/lib/no-dpmem.rel
> > /opt/rtems//pc386/lib/no-event.rel
> > /opt/rt
> > ems//pc386/lib/no-msg.rel /opt/rtems//pc386/lib/no-mp.rel
> > /opt/rtems//pc386/lib/
> > no-part.rel /opt/rtems//pc386/lib/no-signal.rel
> > /opt/rtems//pc386/lib/no-timer.r
> > el /opt/rtems//pc386/lib/no-rtmon.rel
> > o-optimize/testcpp.o: In function `x(void)':
> > /home/angelo/SmartControl/source/hal_rtems/testcpp.cpp:6:
> > undefined reference
> > to
> >  `ifstream::ifstream(int, char const *, int, int)'
> > /home/angelo/SmartControl/source/hal_rtems/testcpp.cpp:7:
> > undefined reference
> > to
> >  `ios::operator void *(void) const'
> > /home/angelo/SmartControl/source/hal_rtems/testcpp.cpp:9:
> > undefined reference
> > to
> >  `endl(ostream &)'
> > /home/angelo/SmartControl/source/hal_rtems/testcpp.cpp:9:
> > undefined reference
> > to
> >  `cout'
> > /home/angelo/SmartControl/source/hal_rtems/testcpp.cpp:9:
> > undefined reference
> > to
> >  `ostream::operator<<(char const *)'
> > /home/angelo/SmartControl/source/hal_rtems/testcpp.cpp:9:
> > undefined reference
> > to
> >  `ostream::operator<<(ostream &(*)(ostream &))'
> > /home/angelo/SmartControl/source/hal_rtems/testcpp.cpp:10:
> > undefined reference
> > t
> > o `fstreambase::close(void)'
> > /home/angelo/SmartControl/source/hal_rtems/testcpp.cpp:14:
> > undefined reference
> > t
> > o `endl(ostream &)'
> > /home/angelo/SmartControl/source/hal_rtems/testcpp.cpp:14:
> > undefined reference
> > t
> > o `cout'
> > /home/angelo/SmartControl/source/hal_rtems/testcpp.cpp:14:
> > undefined reference
> > t
> > o `ostream::operator<<(char const *)'
> > /home/angelo/SmartControl/source/hal_rtems/testcpp.cpp:14:
> > undefined reference
> > t
> > o `ostream::operator<<(ostream &(*)(ostream &))'
> > /home/angelo/SmartControl/source/hal_rtems/testcpp.cpp:17:
> > undefined reference
> > t
> > o `ifstream::~ifstream(void)'
> > /home/angelo/SmartControl/source/hal_rtems/testcpp.cpp:17:
> > undefined reference
> > t
> > o `ifstream::~ifstream(void)'
> > collect2: ld returned 1 exit status
> > make: *** [o-optimize/smart.exe] Error 1
> >
> >
> <snip>
> >

--
Angelo Fraietta

PO Box 859
Hamilton NSW 2303

Home Page

http://users.hunterlink.net.au/~maaaf/

There are those who seek knowledge for the sake of knowledge - that is
CURIOSITY
There are those who seek knowledge to be known by others - that is VANITY
There are those who seek knowledge in order to serve - that is LOVE
    Bernard of Clairvaux (1090 - 1153)







More information about the users mailing list