Cstddef Declaration Errors

closed account (zb0S216C)
I've included <cstddef> into a project of mine in favour of <stddef.h>. When I tried to compile my project, I get 50+ errors stating that types such as "::size_t", "::div_t" and "::abort( )" have not been declared even though <cstddef> includes <stddef.h>.

I've tried searching both the global namespace and the standard namespace, but neither way works. At this moment in time, I don't have any compiler options enabled that may affect the way identifiers are defined, C++11 isn't enabled (which doesn't affect the <cstddef> header anyway), the project is a C++ project, and I've tried using the plain old <stddef.h> header, but the problems still persist.

I'm using GNU's C++ compiler ("__GNUG__" is defined).


Last edited on
Did you try including the <cstring> include file for the size_t definition. And <cstdlib> for the abort() and div_t.

<cstddef> puts everything in the std namespace. If it also puts in the global namespace is up to the implementation.
closed account (zb0S216C)
Thanks for the replies :)

I turns out that the issue was because I've been including <cstddef> after my own headers. It's kinda' strange how something so small can be so irritating.

Thanks again :)

Topic archived. No new replies allowed.