This is the mail archive of the
mailing list for the Cygwin project.
Re: [warning: implicit declaration of function] if enable flag std=c99
Andy Koppe wrote:
> 2009/10/11 Salvatore Santagati:
>> Nope, but under Linux works as well ( with and without std=c99 ) ,
>> under cygwin if enable std=c99
>> I've these type of warning ( source code here is only an example )
> Seems Linux has got it wrong then, because ftello and fseeko are not
> standard C99 functions. Use -std=gnu99 to enable GNU extensions.
This is most likely a variant of the same problem as with snprintf:
Selecting --std=c99 causes __STRICT_ANSI__ to be defined. These functions
are not in c99, so the declarations are wrapped in #ifndef __STRICT_ANSI__.
As the GCC manual says (under '-ansi'):
> The macro `__STRICT_ANSI__' is predefined when the `-ansi' option
> is used. Some header files may notice this macro and refrain from
> declaring certain functions or defining certain macros that the
> ISO standard doesn't call for; this is to avoid interfering with
> any programs that might use these names for other things.
If you use --std=c99, that means you want *only* c99 functions, and have
specifically asked to be warned about non-ANSI functions. I don't understand
why Linux does things differently, it's probably technically wrong but trying
to be helpful, but the fact is that if you write a program strictly according
to the c99 standard, you can't expect there to be a library function called
fseeko and you might in fact expect to be able to use that name for a function
in your own code without any clashes (since the c99 spec doesn't say it is
As a workaround you could use --std=gnu99, which gets you c99 + GCC
extension features but doesn't define __STRICT_ANSI__, or drop it altogether;
what's best depends why you're using the flag in the first place.
The longterm fix is to mark up the newlib headers, looking for "#ifndef
__STRICT_ANSI__" and deciding where to add "|| __STDC_VERSION__ >= 199901L"
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple