c - 处理警告: implicit declaration of function ‘sigignore’

标签 c compilation posix compiler-warnings

这是我的代码:

#include <sys/types.h>
#include <stdio.h>
#include <dirent.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h> 
#include <sys/time.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <signal.h>

int main(int argc, char** argv) {

sigignore(SIGTERM);
return 0;
}

为什么我会收到以下警告以及如何删除它?

implicit declaration of function ‘sigignore’ [-Wimplicit-function-declaration] sigignore(SIGTERM);

程序必须按如下方式编译:gcc -o foo.o foo.c

谢谢

最佳答案

男人sigignore告诉您使用 #define _XOPEN_SOURCE 500 启用 sigignore。有关 X/Open 的更多信息,请参阅 here

关于c - 处理警告: implicit declaration of function ‘sigignore’ ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36696318/

相关文章:

c - 复制文件中的单个字符

c - 以字符串形式读取文件

linux - 关于 pthread_create 和文件描述符,我可以假设什么?

c - 使用内存映射或解锁流操作?

将malloc的虚拟地址转换为用户空间的物理地址

c - 我在 c 中得到了意外的输出 .. 谁能解释为什么?

c++ - C++代码在编译过程中是否转换为C?

Java程序在cmd中执行而不使用设置路径或系统变量

c++ - 现代 C++ 编译器是否优化了对类的同一数据成员的重复访问?

arrays - 为什么这个数组检查 key 失败?