[tbm at cyrius.com: Bug#441533: GCC 4.3 related: missing #includes]
Marc Glisse
marc.glisse at normalesup.org
Tue Dec 11 08:03:03 CET 2007
On Mon, 10 Dec 2007, Tim Van Holder wrote:
>> A Debian user has reported a missing #include in gmp.h.
>>> /usr/include/gmp.h:520: error: 'std::FILE' has not been declared
>>
>> +#include <iostream> /* for std::FILE */
>
> std::FILE is the C++ way of referring to C's file - so I think the
> correct include is <cstdio>, NOT <iostream>.
Indeed.
Besides, I don't think there is a missing #include in gmp.h, the error
lies elsewhere. The code with FILE in gmp.h is protected by a check that
the stdio header was included. Now I believe the issue is that the
glibc/gcc standard headers are c++-buggy in the sense that including
stdio.h puts FILE only in the global namespace and not also in the std::
namespace as it should. Alternatively, the kde code that includes stdio.h
before including gmp.h should include cstdio instead (or both just to be
sure).
Note that it is a documented feature of gmp that you need to include
stdio.h/cstdio before gmp.h if you want the FILE related functions.
Now the reason for not including stdio by default for gmp is I think less
relevant for C++ than for C, and it could make sense to always include it
for C++ the way S. Robbins suggests.
--
Marc Glisse
More information about the gmp-bugs
mailing list