List Info

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




gcc 4.3pre (20070824) vs. gmp.h: error: ‘std::FILE’ has not been declared
country flaguser name
Germany
2007-08-25 19:24:18
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:

[mabshoffm940 src]$ cat gmp-version-check.c
#include <gmp.h>

int main ()
{
  if (__GNU_MP_VERSION < 4)
    return -1;
  else
    return 0;
}

[mabshoffm940 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-bugsswox.com
http://swox
.com/mailman/listinfo/gmp-bugs

Re: gcc 4.3pre (20070824) vs. gmp.h: error: ‘std::FILE’ has not been declared
user name
2007-08-26 04:10:33
Hello,

  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" {
#ifdef _GMP_H_HAVE_FILE
using std::FILE;
#endif
#endif

 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.

--
 Sincerely,
  Patrick Pélissier

On 8/26/07, Michael Abshoff
<Michael.Abshofffsmath.mathematik.uni-dortmund.de>
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:
>
> [mabshoffm940 src]$ cat gmp-version-check.c
> #include <gmp.h>
>
> int main ()
> {
>   if (__GNU_MP_VERSION < 4)
>     return -1;
>   else
>     return 0;
> }
>
> [mabshoffm940 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-bugsswox.com
> http://swox
.com/mailman/listinfo/gmp-bugs
>
_______________________________________________
gmp-bugs mailing list
gmp-bugsswox.com
http://swox
.com/mailman/listinfo/gmp-bugs

Re: gcc 4.3pre (20070824) vs. gmp.h: error: ‘std::FILE’ has not been declared
country flaguser name
Germany
2007-08-26 07:48:48
Patrick Pelissier wrote:
> Hello,
>

Hello Patrick,

>   I have heard that g++ 4.3 has reduced a lot the
dependencies between
> the system headers.

Okay, that matches my experience after compiling LinBox and
a couple other
mathematical packages.

>   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.
>

Great, esprecially with the "-E" option I forgot
about.

>  I think the correct way to fix is:
>
> #if defined (__cplusplus)
> extern "C" {
> #ifdef _GMP_H_HAVE_FILE
> using std::FILE;
> #endif
> #endif
>
>  But I am not a C++ expert.
>

Does this stand a chance to get merged for a hypothetical
4.2.2? Torbjorn,
can you tell us if that is an acceptable solution or if you
prefer
something else.

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

I "fixed" it by including string.h in givaromm.C,
but I am sure Clement
Pernet or somebody else out of the Givaro team will decide
which way to
fix it best. I have attached your suggestion to the ticket
in Sage trac
ticket.

> --
>  Sincerely,
>   Patrick Pélissier
>

Cheers,

Michael

> On 8/26/07, Michael Abshoff
> <Michael.Abshofffsmath.mathematik.uni-dortmund.de> 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:
>>
>> [mabshoffm940 src]$ cat gmp-version-check.c
>> #include <gmp.h>
>>
>> int main ()
>> {
>>   if (__GNU_MP_VERSION < 4)
>>     return -1;
>>   else
>>     return 0;
>> }
>>
>> [mabshoffm940 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-bugsswox.com
>> http://swox
.com/mailman/listinfo/gmp-bugs
>>
>


_______________________________________________
gmp-bugs mailing list
gmp-bugsswox.com
http://swox
.com/mailman/listinfo/gmp-bugs

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )