Compiling a C program with g++ 4.3.1 yields an error about std::FILE
Marc Glisse
marc.glisse at normalesup.org
Mon Aug 11 15:57:56 CEST 2008
On Mon, 21 Jul 2008, Torbjorn Granlund wrote:
> So, this is what you're suggesting:
>
> At the beginning of the file:
>
> #if defined (__cplusplus)
> #include <iosfwd> /* for std::istream, std::ostream, std::string */
> #include <cstdio>
> #endif
>
> And around line 520:
>
> #if defined (__cplusplus)
> extern "C" {
> using std::FILE;
> #endif
Apparently this was forgotten for 4.2.3.
In 4.2.3, in C++, gmp.h always includes cstdio, but only declares the
gmp_fprintf and co functions if stdio.h or cstdio was included before
gmp.h, because the _GMP_H_HAVE_FILE macro doesn't get set otherwise. By
the way, with glibc and g++, part of stdio.h already gets included
indirectly by iosfwd, but it only defines __FILE_defined, which is not
tested by _GMP_H_HAVE_FILE (don't know if it should be).
I also noticed that if I use the Sun compiler on linux-x86 (the compiler
is common for x86 and x86_64), configure choses ABI=64, which obviously
fails. Well I just set ABI=32 and there is no problem.
--
Marc Glisse
More information about the gmp-bugs
mailing list