------- Comment #15 from neroden at gcc dot gnu dot org 2005-10-03 03:42 ------- So there's a problem with the multiple-include-protection in glibc! We actually want to include the headers twice, potentially -- once when included via <cstdio> et al, with everything in namespaces, and once when included directly via <stdio.h> et al, with everything outside them. They actually shouldn't conflict because that's the whole *point* of putting stuff in a namespace.
But we can't do this in any manner because they have multiple-include protection which can't tell the difference. I think this should be solved in glibc. Feel free to forward this suggestion and this code (which I donate to the public domain) to somewhere appropriate. At the beginning of stdio.h, instead of: #ifndef _STDIO_H #define _STDIO_H we would have: #if ( ( defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES ) \ && ! defined _STDIO_H_WITH_NAMESPACES ) \ || ( (! defined __cplusplus || ! defined _GLIBCPP_USE_NAMESPACES )\ && ! defined _STDIO_H ) #if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES # define _STDIO_H_WITH_NAMESPACES #else # define _STDIO_H #endif For glibc, _GLIPCPP_USE_NAMESPACES could be defined in <cstdio> before the inclusion of stdio.h and undefined afterwards. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6257