标题:简单程序出了错误,帮改改
只看楼主
lansha001
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2008-4-12
 问题点数:0 回复次数:1 
简单程序出了错误,帮改改
这是个定时程序
1.    #include <signal.h>
2.    #include <unistd.h>
3.    #include <string.h>
4.    #include <stdio.h>
5.    
6.    static char msg[] = "I received a msg.\n";
7.    int len;
8.    void show_msg(int signo)
9.    {
10.    write(STDERR_FILENO, msg, len);
11.    }
12.    int main()
13.    {
14.    struct sigaction act;
15.    union sigval tsval;
16.    
17.    act.sa_handler = show_msg;
18.    act.sa_flags = 0;
19.    sigemptyset(&act.sa_mask);
20.    sigaction(50, &act, NULL);
21.    
22.    len = strlen(msg);
23.    while ( 1 )
24.    {
25.    sleep(2); /*睡眠2秒*/
26.    /*向主进程发送信号,实际上是自己给自己发信号*/
27.    sigqueue(getpid(), 50, tsval);
28.    }
29.    return 0;
30.    }
程序在执行过程中出现错误:C(1 ):error c2059:syntax error:’constant’
                         C(1):error c2014:preprocessor command must start as first nonwhite space
                                           C(2) :error c2014:preprocessor command must start as first nonwhite space
                                           C(3):error c2014:preprocessor command must start as first nonwhite space
                                          C(4):error c2014:preprocessor command must start as first nonwhite space  
                                        C(7):error c2059:syntax error:’constant’
                      C(8):error c2059:syntax error:’constant’
                                      C(12):error c2059:syntax error:’constant’
搜索更多相关主题的帖子: 改改 
2008-05-27 10:10
语虫
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2008-5-18
得分:0 
晕,都是些什么东西!
根本就不对!
2008-05-27 13:05



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-216098-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.772940 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved