[Xfc-dev] XFC Compilation error with gcc 3.3.5 and 3.4.3
Jeff Franks
jcfranks at tpg.com.au
Fri Mar 4 23:39:14 CET 2005
Jasper Huijsmans wrote:
> Xavier Otazu wrote:
> ...
>
>>
>> When using gcc 3.3.5 I receive:
>>
>> g++ -DHAVE_CONFIG_H -I. -I. -I../../../libXFCcore
>> -I../../../libXFCui -g -O2
>> -Wall -ansi -pedantic-errors -I/usr/local/include/sigc++-2.0
>> -I/usr/local/lib/sigc++-2.0/include -pthread -I/usr/include/glib-2.0
>> -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0
>> -I/usr/lib/gtk-2.0/include
>> -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/X11R6/include
>> -I/usr/include/freetype2 -I/usr/include/glib-2.0
>> -I/usr/lib/glib-2.0/include -g
>> -O2 -Wall -ansi -pedantic-errors -MT colorselection.lo -MD -MP -MF
>> .deps/colorselection.Tpo -c colorselection.cc -fPIC -DPIC -o
>> .libs/colorselection.o
>> /usr/local/include/c++/3.3.5/bits/stl_construct.h: In
>> function `void std::_Construct(_T1*, const _T2&) [with _T1 =
>> Xfc::Gdk::Color,
>> _T2 = Xfc::Gdk::Color]':
>> /usr/local/include/c++/3.3.5/bits/stl_vector.h:599: instantiated
>> from `void
>> std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp =
>> Xfc::Gdk::Color,
>> _Alloc = std::allocator<Xfc::Gdk::Color>]' colorselection.cc:88:
>> instantiated
>> from here /usr/local/include/c++/3.3.5/bits/stl_construct.h:78: error: no
>
This line (stl_construct.h:78) is the problem. See end of email...
>>
>> matching function for call to `Xfc::Gdk::Color::operator
>> new(unsigned int,
>> void*&)' ../../../libXFCcore/xfc/trackable.hh:168: error: candidates
>> are: static
>> void* Xfc::Trackable::operator new(unsigned int)
>> make[5]: *** [colorselection.lo] Error 1
>> make[5]: Leaving directory `/usr/local/src/xfc-4.3.0/libXFCui/xfc/gtk'
>> make[4]: *** [all-recursive] Error 1
>> make[4]: Leaving directory `/usr/local/src/xfc-4.3.0/libXFCui/xfc/gtk'
>> make[3]: *** [all-recursive] Error 1
>> make[3]: Leaving directory `/usr/local/src/xfc-4.3.0/libXFCui/xfc'
>> make[2]: *** [all-recursive] Error 1
>> make[2]: Leaving directory `/usr/local/src/xfc-4.3.0/libXFCui'
>> make[1]: *** [all] Error 2
>> make[1]: Leaving directory `/usr/local/src/xfc-4.3.0/libXFCui'
>> make: *** [all-recursive] Error 1
>>
>
> I just got this same error on lunar with gcc 3.3.3. Any ideas?
Well, this was a bug in the standard C++ library included with GCC
versions up to 3.3.5. It was fixed in GCC 3.4.0. It's a one-liner fix
though. So if you don't want to or can't upgrade to GCC 3.4.0 or
greater, and you have root access, I suggest you make the fix yourself.
Xfc::Trackable overrides operator new, a standard C++ thing to do in
custom memory management. The bug is that std::_Construct<> called by
std::vector<Gdk::Color> from xfc/gtk/colorselection.cc on line 88 should
call the global new operator (specified like this ::new) but it calls
Xfc::Trackable::operator new, because the call to operator new in
/usr/include/c++/3.3.5/bits/stl_construct.h in line 89 forgot to specify
the scope resolution operator before operator new.
lines 86 - 89 from stl_construct.h 3.3.5:
86 template <class _T1>
87 inline void
88 _Construct(_T1* __p)
89 { new (static_cast<void*>(__p)) _T1(); }
line 89 should read:
86 template <class _T1>
87 inline void
88 _Construct(_T1* __p)
89 { ::new (static_cast<void*>(__p)) _T1(); }
so just add the scope operator and XFC will compile.
I will have change the docs to mention this bug and suggest this fix or
use GCC 3.4.0 or greater.
Regards,
Jeff.
More information about the Xfc-dev
mailing list