C++ Usage Issues - Problems, Solutions, and Suggestions

Robert S. Grimes rsg at alum.mit.edu
Thu Jun 21 15:22:06 UTC 2007


Ralf Corsepius wrote:
>>     LD_LIBS   += -lstdc++
>>     
> No, using "<target>-gcc -lstdc++" is never correct. You have to use 
> "<target>-g++" instead of "<target>-gcc" to link c++ code.
>   
Oops, I missed that - of course, I didn't know that I had.  I was about
to ask, but then a bit of poking around led me to virtex.cfg, where
there is a make-cxx-exe rule, which indeed fixes it correctly - Thanks Ralf!

For others who may be in my "naive" camp, the rule in the Template
makefile (make/Templates/Makefile.leaf) that links a C executable looks
like this:

    ${ARCH}/xxx-your-program-here: ${OBJS} ${LINK_FILES}
        $(make-exe)


For C++ applications, change it to this:

    ${ARCH}/xxx-your-program-here: ${OBJS} ${LINK_FILES}
        $(make-cxx-exe)

Joel, maybe this should also be in the Template file, at least a
commented-out version?  I'm not sure I ever would have figured out the
correct way to link if Ralf had not corrected me.
>   
>> The other errors are due to the rtems/rtems_bsdnet.h header file, and
>> can be eliminated by changing the inclusion of this file like this:
>>
>>     extern "C" {
>>     #include <rtems/rtems_bsdnet.h>
>>     }
>>     
> If this works, you've found a bug inside of this header. This header must be C-safe.
>   
Yes, this header is not correct.
>
> Ralf
>
>
>
>   



More information about the users mailing list