编写linux守护进程的头文件问题

软件和网站开发以及相关技术探讨
回复
mgqw
帖子: 59
注册时间: 2006-11-09 21:06
来自: 深圳

编写linux守护进程的头文件问题

#1

帖子 mgqw » 2007-09-26 9:24

最近在学习编写linux守护进程,在网上查了一些资料,然后直接下了一段源代码(说是RedHat Linux6.0下编译通过),结果在我的ubuntu7.04上编译报错,我虽然不精通C语言但自认为基础还算可以,看报错提示个人想应该是缺少头文件,请问各位大侠编写linux守护进程的头文件该怎么下载?
报错代码如下:
jinfan@jinfan-laptop:~/Desktop$ gcc -o test test.c
test.c:1:21: 错误: stdio.h :No such file or directory
test.c:2:20: 错误: time.h :No such file or directory
test.c:3:22: 错误: unistd.h :No such file or directory
test.c:4:22: 错误: signal.h :No such file or directory
test.c:5:25: 错误: sys/param.h :No such file or directory
test.c:6:25: 错误: sys/types.h :No such file or directory
test.c:7:24: 错误: sys/stat.h :No such file or directory
test.c: 在函数 ‘main’ 中:
test.c:15: 错误: ‘FILE’ 未声明 (在此函数内第一次使用)
test.c:15: 错误: (即使在一个函数内多次出现,每个未声明的标识符在其
test.c:15: 错误: 所在的函数内只报告一次。)
test.c:15: 错误: ‘fp’ 未声明 (在此函数内第一次使用)
test.c:16: 错误: ‘time_t’ 未声明 (在此函数内第一次使用)
test.c:16: 错误: expected ‘;’ before ‘t’
test.c:24: 错误: ‘t’ 未声明 (在此函数内第一次使用)
test.c:25: 警告: 隐式声明与内建函数 ‘fprintf’ 不兼容
test.c: 在函数 ‘init_daemon’ 中:
test.c:37: 警告: 隐式声明与内建函数 ‘exit’ 不兼容
test.c:51: 错误: ‘NOFILE’ 未声明 (在此函数内第一次使用)
附件
test.c.tar.gz
程序的源代码
(826 Bytes) 已下载 89 次
头像
bones7456
帖子: 8495
注册时间: 2006-04-12 20:05
来自: 杭州
联系:

#2

帖子 bones7456 » 2007-09-26 9:32

#include<stdio.h>
这里面的空格拿掉...
关注我的blog: ε==3
mgqw
帖子: 59
注册时间: 2006-11-09 21:06
来自: 深圳

#3

帖子 mgqw » 2007-09-26 10:01

晕死,谢谢了。
不好意思阿,麻烦大侠了 :oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops:
回复