linux+中的代码如何编译错误,在Linux中使用signal.h编译错误

参见英文答案 >

struct sigaction incomplete error                                    2

我正在编写一个必须处理信号的shell程序.我的相关信号处理相关代码如下:

#include

...

#include

...

void installSigactions( int, struct sigaction* );

void handler_function( int signal_id );

...

/*define signal table*/

struct sigaction signal_action;

/*insert handler function*/

signal_action.sa_handler = handler_function;

/*init the flags field*/

signal_action.sa_flags = 0;

/*are no masked interrupts*/

sigemptyset( &signal_action.sa_mask );

/*install the signal_actions*/

sigaction( SIGINT, &signal_action, NULL );

编译给我以下警告和错误:

gcc -Wall -ggdb -ansi -static -pedantic -o os1shell2 os1shell2.c

os1shell2.c:35: warning: 'struct sigaction' declared inside parameter list

os1shell2.c:35: warning: its scope is only this definition or declaration,

which is probably not what you want

os1shell2.c: In function 'main':

os1shell2.c:66: error: storage size of 'signal_action' isn't known

os1shell2.c:75: warning: implicit declaration of function 'sigemptyset'

os1shell2.c:78: warning: implicit declaration of function 'sigaction'

任何人都可以告诉我为什么我得到这些警告和错误?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值