C 编译错误是什么;SIG_块未声明”;什么意思?

C 编译错误是什么;SIG_块未声明”;什么意思?,c,gcc,ubuntu-14.04,C,Gcc,Ubuntu 14.04,当使用-ansi编译时,我收到一条错误消息error:“SIG_BLOCK”未声明 sigprocmask(SIG_块和my_SIG,NULL) 我是不是忘了明确一些头文件?这些是我的包裹 #include <sys/stat.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include <dirent.h> #include <errno.h>

当使用
-ansi
编译时,我收到一条错误消息
error:“SIG_BLOCK”未声明

sigprocmask(SIG_块和my_SIG,NULL)

我是不是忘了明确一些头文件?这些是我的包裹

#include <sys/stat.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <dirent.h>
#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括

您需要告诉编译器您想要定义
SIG\u块

发件人:

glibc的特性测试宏要求(参见):

所以你可能想通过这个选项

-D_POSIX_SOURCE

以gcc为例

或者,您可以将这些“请求”作为预处理器指令放在源代码的顶部:

#define _POSIX_SOURCE
... /* other includes */
#include <signal.h>
#定义POSIX_SOURCE
... /* 其他包括*/
#包括

\define\u POSIX\u C\u源代码1
... /* 其他包括*/
#包括

您使用的编译器是什么?传递给编译器的命令行指令集是什么?可以通过将正确的命令行参数传递给编译器来删除警告。
-D_POSIX_C_SOURCE=1
#define _POSIX_SOURCE
... /* other includes */
#include <signal.h>
#define _POSIX_C_SOURCE 1
 ... /* other includes */
#include <signal.h>