[Xfc-dev] Re: Bit of a compile problem with XFC
Jeff Franks
jcfranks at tpg.com.au
Fri Apr 22 11:16:12 CEST 2005
Jasper Huijsmans wrote:
>On Thu, Jul 14, 2005 at 10:22:44AM +0000, Jeff Franks wrote:
>
>
>>Gareth, XFC wont compile with gcc 3.3.5 because there was a bug in
>>stl_construct.h that was fixed in gcc 3.4.0. Two choices, use gcc 3.4.x,
>>or easier still if you have root access, in your file
>></usr/include/c++/3.3/bits/stl_construct.h> at line 78 insert a scope
>>resolution operator in front of operator new so that it reads:
>>
>>::new(static_cast<void*>(__p)) _T1(__value);
>>
>>instead of:
>>
>>new(static_cast<void*>(__p)) _T1(__value);
>>
>>and XFC will compile.
>>
>>
>>
>
>Hey Jeff, this is starting to be a real FAQ, isn't it?
>
>I wonder if it would be possible to override the prototype for new when
>compiling with gcc < 3.4. I'm totally without knowledge on C++, so this may be
>absolute nonsense, but I was think of something like:
>
>#if GCC_CMAJOR_VERSION < 4 && GCC_MINOR_VERSION < 4
>// override prototype new operator
>::new (whatever)
>#endif
>
>or something to that effect...
>
>
>
The compile problem is a libstdc++ bug. Versions < 3.4.0 forgot to place
the scope resolution operator in front of operator new. This meant that
the libstdc++ functions in </usr/include/c++/3.3/bits/stl_construct.h>
called the Xfc::Trackable class new operator instead of the global new
operator.
It just dawned, I might be able to. The offending libstdc++ constructor
functions call "placement operator new" which Xfc::Trackable does not
define, hence the compile error. I'll have a look defining "placement
new" for the case you mention (GCC_MAJOR_VERSION < 4 &&
GCC_MINOR_VERSION < 4) which could then just call global placement new.
Regards,
Jeff.
More information about the Xfc-dev
mailing list