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

Vincent Lefevre vincent at vinc17.org
Tue Jun 10 16:38:20 CEST 2008


On 2008-06-10 09:34:17 -0500, Steve M. Robbins wrote:
> The Debian patch does use cstdio.

Yes, FYI:

vin:~> diff -u x86_64/include/gmp.h /usr/include/gmp.h
--- x86_64/include/gmp.h        2008-02-18 13:36:05.000000000 +0100
+++ /usr/include/gmp.h  2008-04-09 09:22:56.000000000 +0200
@@ -418,9 +418,13 @@
     for an inline too, so as to correctly specify "dllimport" on windows, in
     case the function is called rather than inlined.
     GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
-    inline semantics, unless -fgnu89-inline is used.  */
+    inline semantics, unless -fgnu89-inline is used.
+
+   With GCC 4.2, `__GNUC_STDC_INLINE__' is never defined (because C99 inline
+   semantics are not supported), but a warning is issued in C99 mode if
+   `__gnu_inline__' is not used.  */
 #ifdef __GNUC__
-#ifdef __GNUC_STDC_INLINE__
+#if (defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 2)
 #define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__))
 #else
 #define __GMP_EXTERN_INLINE      extern __inline__
@@ -516,6 +520,7 @@
 
 #if defined (__cplusplus)
 extern "C" {
+#include <cstdio>
 #ifdef _GMP_H_HAVE_FILE
 using std::FILE;
 #endif

-- 
Vincent Lefèvre <vincent at vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


More information about the gmp-bugs mailing list