c - mkstemp 函数的隐式声明

标签 c cygwin mkstemp

我的 mkstemp() 函数有问题cygwin 上的 GCC 编译器生成警告:

implicit declaration of function ‘mkstemp‘

GCcflags:-std=c99 -Wall

包括:

#include </usr/include/stdlib.h>
#include </usr/include/unistd.h>

最佳答案

在我的 cygwin stdlib.h 中,有 mkstemp 声明,如下所示:

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

看起来mkstemp不是ANSI C。确保您没有将编译器设置为强制执行特定标准(放弃 c99),并且不要使用 -ansi/-pedantic 标志。

另外...放弃 #include 中的 /usr/include/ 部分。编译器会为您处理这些事情。

关于c - mkstemp 函数的隐式声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24758058/

相关文章:

c - 使用 Cygwin 编译 C 程序;执行错误

git - 处理访问同一存储库的 Cygwin Git 和 Git for Windows 中的 EOL 字符

c++ - win32 的 mkstemp() 实现

c - malloc() 之后访问数组时突然出现段错误

为 openvz VM 编译内核模块?

c - 使用 strcpy 将 "string"复制到结构成员 char* 时出现段错误

c - 如何在没有相同引用的情况下将文本文件中的字符串存储在 C 中?

bash - 排序 |独特 | xargs grep ... 其中行包含空格

c++ - win32 的 mkstemp() 实现