C++ Usage Issues - Problems, Solutions, and Suggestions
ralf.corsepius at rtems.org
Thu Jun 21 16:56:06 UTC 2007
On Thu, 2007-06-21 at 12:07 -0400, Robert S. Grimes wrote:
> Joel Sherrill wrote:
> > Robert S. Grimes wrote:
> >> Ralf Corsepius wrote:
> >>> 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.
The rationale is quite simple: Linking c++ is more than "just adding a
library". G++ reflects this thought and treats libstdc++ as an internal
implementation detail users are not supposed having to touch.
On some targets/with some compilers "linking c++" is effectively "just
adding -lstdc++" but on most others it is more. What confuses some users
is "gcc ... -lstdc++" once having been worked with old gcc (IIRC, gcc <
4.0) on i386 targets.
> > I just committed a fix for this and the others in the libnetworking/rtems
> > directory that were not doing an extern "C".
> I see that you used the old #ifdef __cplusplus approach. Should we use
> the _BEGIN_STD_C/_END_STD_C macros that are used elsewhere, such as
Please don't. We have 2007 and are not in 1997, anymore ;)
Let's use as few external macros as possible.
> See the $TARGET/include/_ansi.h file, at the
== newlib file == external macro.
More information about the users