0

I have a problem with the function mkstemp(). GCC compiler on cygwin generates a warning:

implicit declaration of function ‘mkstemp‘

GCC flags: -std=c99 -Wall

Includes:

#include </usr/include/stdlib.h>
#include </usr/include/unistd.h>
Mark
  • 2,380
  • 11
  • 29
  • 49
Heniek
  • 563
  • 2
  • 8
  • 17

1 Answers1

0

In my cygwin stdlib.h has mkstemp declaration guarded like this:

#ifndef __STRICT_ANSI__
#ifndef _REENT_ONLY
int _EXFUN(mkstemp,(char *));
#endif

Seems like mkstemp is not ANSI C. Make sure you don't have your compiler set to enforce a specific standard (ditch the c99) and don't use -ansi/-pedantic flags.

Also ... ditch the /usr/include/ part in your #includes. The compiler takes care of that for you.

dragosht
  • 3,237
  • 2
  • 23
  • 32
  • I wanted to enforce standard c99 because of "‘for’ loop initial declarations are only allowed in C99 mode" – Heniek Jul 15 '14 at 13:18
  • 1
    You could use `-std=gnu99` instead (but beware: this causes some non-conforming behavior in the compiler, including certain floating point breakage) or `-U__STRICT_ANSI__` to omit the `__STRICT_ANSI__` macro while keeping C99 features. – R.. GitHub STOP HELPING ICE Jul 15 '14 at 13:35