Compiling a C program with g++ 4.3.1 yields an error about std::FILE
Torbjorn Granlund
tg at swox.com
Mon Jul 21 17:30:34 CEST 2008
Marc Glisse <marc.glisse at normalesup.org> writes:
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
defined...
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.
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
--
Torbjörn
More information about the gmp-bugs
mailing list