Re: gcc 4.3pre (20070824) vs. gmp.h: error: ‘std::FILE’ has not been declared

Patrick Pelissier patrick.pelissier at
Sun Aug 26 11:10:33 CEST 2007


  I have heard that g++ 4.3 has reduced a lot the dependencies between
the system headers.
  Before FILE was defined even if stdio.h was not included explicitly
(See the output of g++ -E).
 Now (4.3), it is not more defined, thought the error.

 I think the correct way to fix is:

#if defined (__cplusplus)
extern "C" {
using std::FILE;

 But I am not a C++ expert.

  For checking of givaro inside the configure, as a work-around,
  I suggest including cstdio explicitly before gmp.h.

  Patrick Pélissier

On 8/26/07, Michael Abshoff
<Michael.Abshoff at> wrote:
> Hello,
> I ran into the following problem when compiling the following AC_CHECK
> snippet with gcc 4.3pre (20070824 snapshot) when using gmp release 4.2.1:
> [mabshoff at m940 src]$ cat gmp-version-check.c
> #include <gmp.h>
> int main ()
> {
>   if (__GNU_MP_VERSION < 4)
>     return -1;
>   else
>     return 0;
> }
> [mabshoff at m940 src]# g++ -I ../../../../local/include/ gmp-version-check.c
> -lgmp
> In file included from gmp-version-check.c:1:
> ../../../../local/include/gmp.h:515: error: 'std::FILE' has not been declared
> (the code compiled fine with gcc, because the offending bit is ifdefd with
> __cplusplus). Removing the offending "using std::FILE" make the code in
> question (which originated in the AC_CHECK of givaro) and givaro itself (a
> C++ library for arithmetic and algebraic computations) compile. But the
> sample problem should show up in any C++ libary or code including gmp.h
> Now my questions:
> - Is that the recommended work-around or am I doing something wrong?
> - I have to admit my ignorance: Why are we using "using std::FILE" there?
> Is it even needed for g++?
> Cheers,
> Michael
> _______________________________________________
> gmp-bugs mailing list
> gmp-bugs at

More information about the gmp-bugs mailing list