如果我编译std = c99下面的程序,我得到一个错误,但程序编译罚款没有c99标志。为什么?为什么我无法使用std = c99声明sigset_t?
#include <signal.h>
void x()
{
sigset_t dd;
}
int main(void)
{
x();
return 0;
}
[email protected] temp]$ gcc -std=c99 blah.c -o blah
blah.c: In function ‘x’:
blah.c:9: error: ‘sigset_t’ undeclared (first use in this function)
blah.c:9: error: (Each undeclared identifier is reported only once
blah.c:9: error: for each function it appears in.)
blah.c:9: error: expected ‘;’ before ‘dd’
它需要'_GNU_SOURCE'与C99标准编译此。改用'gcc -std = c99 -D_GNU_SOURCE blah.c -o blah'来代替。 – 2012-11-29 03:22:22
@ user9000为什么要用'-std = c99'呢?只需使用'gcc -std = gnu99'即可完成。 – melpomene
@melpomene这与它有什么关系? '_GNU_SOURCE'使一些GNU扩展可用。 – 2012-11-29 03:27:48