Re: gcc 8.2.0: missing _fileno() for c++11

Eli Zaretskii <eliz-mXXj517/[email protected]> Mon, 20 Jan 2020 21:36:44 +0200
Newsgroups gmane.comp.gnu.mingw.user
Message-ID <[email protected]>
> Date: Mon, 20 Jan 2020 22:26:21 +0300
> From: Anton Shepelev <[email protected]>
> 
> > int main( void )
> > {  FILE *f;
> >    _fileno( f );
> >    return 0;
> > }
> >
> > saved in test.cpp, will not compile with:
> >
> >     gcc -std=c++11 test.cpp
> 
> Here is the full gcc output when building as C++11:
> 
> test.cpp: In function 'int main()':
> test.cpp:5:4: error: '_fileno' was not declared in this scope
>     _fileno( f );
>     ^~~~~~~
> test.cpp:5:4: note: suggested alternative: '_filbuf'
>     _fileno( f );
>     ^~~~~~~
>     _filbuf
> 
> According to:
>   https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fileno
> _fileno() shall be declared in stdio.h .

Doesn't -std=c++11 request strict ANSI C++?  _fileno is non-ANSI, and
thus isn't visible in a strict-ANSI compilation.  I suggest to try the
option -std=gnu++11 instead.

_______________________________________________
MinGW-Users mailing list
[email protected]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.osdn.me/mailman/listinfo/mingw-users
Also: mailto:[email protected]?subject=unsubscribe