multiple definition of `std::__default_alloc_template<(bool)1, (int)0>::allocate(unsigned)'

Loren James Rittle rittle@latour.rsch.comm.mot.com
Wed May 1 22:47:00 GMT 2002


Hi Guys,

> You'll need to supply a testcase, and give details on your build
> configuration.

True.  Sorry, but I am not seeing these issues.  Until I get a
repeatable test case, I will not be able to look at it.

> Loren, can you see if 'make check-script' is passing on i386/bsd for
> static bits?

All test cases are running like fine swiss watches (except those cases
which are only suppose to compile and/or link but not link and/or run).

Gerald, you should know all this but in case not:

The libstdc++.so ELF library has a bound dependency on -lm (in my
environment that translates to libm.so.2).  Thus, you can link
dynamically without -lm but -static cases must explicitly provide -lm
if math library calls like finitef() are used by the library
implementation.

Then again, the g++ driver appears to add -lm.  Thus, the only way I
can "reproduce" your error message is with a convoluted command
sequence such as this (for our time's sake, please post exactly how
you are getting errors even if you can't post the full test case):

$ /usr/local/beta-gcc/bin/g++ -I. -c narrow_stream_objects.cc
$ /usr/local/beta-gcc/bin/gcc narrow_stream_objects.o -lstdc++
$ /usr/local/beta-gcc/bin/gcc -static narrow_stream_objects.o -lstdc++
/usr/local/beta-gcc/lib/gcc-lib/i386-unknown-freebsd4.5/3.1/../../../libstdc++.a(c++locale.o): In function `void std::__convert_to_v<long double>(char const*, long double&, std::_Ios_Iostate&, int* const&, int)':
/usr/users/rittle/tmp/gcc-build-latour-3.1-0430/i386-unknown-freebsd4.5/libstdc++-v3/include/bits/ios_base.h:123: undefined reference to `finitef'
collect2: ld returned 1 exit status

You are linking your C++ programs with g++?  Or, if you want to use
gcc instead, then you must add -lm whenever -static and -lstdc++ are
provided.

I suspect that you got burned since you were attempting to test a
particular version of GNU ld by hand.  PLEASE don't do that.  (I can
attempt to explain why if you don't know why.  And BTW, just because I
can explain why doesn't mean I agree with the current trend that
causes it...)

Regards,
Loren
-- 
Loren J. Rittle
Senior Staff Software Engineer, Distributed Object Technology Lab
Networks and Infrastructure Research Lab (IL02/2240), Motorola Labs
rittle@rsch.comm.mot.com, KeyID: 2048/ADCE34A5, FDC0292446937F2A240BC07D42763672



More information about the Libstdc++ mailing list