mkstemp implicit declaration of function

1.7k views Asked by At

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

There are 1 answers

2
dragosht On

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.