On 11/02/2011 18:38, Jonathan Wakely wrote:
> On 11 February 2011 18:30, Remi Collet wrote:
>>
>> Hi,
>>
>> During fedora 15 mass rebuild, mysql++ fails to build because of some
>> changes in new GCC 4.6.
>>
>> In file included from ./lib/sql_buffer.h:31:0,
>> from ./lib/sql_buffer.cpp:26:
>> ./lib/refcounted.h:258:2: error: 'size_t' does not name a type
>>
>>
>> From GCC documentation:
>>
>> STL headers not including<cstddef> any longer
>>
>> 2 solutions :
>> - include<cstddef>
>> - use std::size_t
>
> std::size_t is defined by<cstddef>, so the correct fix if you want to
> use size_t is to explicitly include either<stddef.h> (for ::size_t)
> or<cstddef> (for std::size_t)
>
> Otherwise some other change to the Standard Library could cause the
> same problem again. If you use a type, include the header that
> declares it.
>
Jonathan,
Isn't that what Remi said? I believe his two solutions were
to be employed simultaneously, not as an "either/or" set of
options. It would certainly make sense.
Also, actually, including stddef.h brings the symbols into
the `std` namespace *and* the global namespace. See D.5 in 2003.
cstddef is indeed preferred, though.
Tom