Compiling a C program with g++ 4.3.1 yields an error about std::FILE

Marc Glisse marc.glisse at
Mon Jul 21 16:51:23 CEST 2008

On Mon, 21 Jul 2008, Torbjorn Granlund wrote:

>  @@ -516,6 +520,7 @@
>   #if defined (__cplusplus)
>   extern "C" {
>  +#include <cstdio>
>   #ifdef _GMP_H_HAVE_FILE
>   using std::FILE;
>   #endif
> I applied this patch.

I know debian did it this way, but could you please put the #include line 
one line higher? These standard files are not meant to be included in 
weird situations like a namespace or a non-default linkage.

Besides, the "using std::FILE" should now be unconditional. cstdio is 
included in the line above so std::FILE must exist, but cstdio is included 
after the long macro check that defines _GMP_H_HAVE_FILE so it is not 

Maybe the include line would actually be best next to the iosfwd one at 
the beginning of the header?

Note: I am not discussing the ugliness of the solution, just trying to 
make the result correct.

Marc Glisse

More information about the gmp-bugs mailing list