Begin Linux Prog - Drivers -Errors
Hi, new here, and having trouble with hello.c compliling.
I am using Fedora Core 2, and I am trying to compile hello.c in chapter 18 of the book Beginning Linux Programming 3rd edition!
Thanks for the great book. Hope to be on this site to pick more brains!
Here is the output from the screen. I modified the directories to work with my setup, only where the h files are located.
Thanks for the help.
[root@PositekVoice hfc]# gcc -D__KERNEL__ -I/usr/src/linux-2.6.5-1.358/include/linux -DMODULE -Wall -O2 -c hello.c -o hello.o
In file included from /usr/src/linux-2.6.5-1.358/include/linux/module.h:9,
from hello.c:4:
/usr/include/linux/config.h:5:2: #error Incorrectly using glibc headers for a kernel module
In file included from /usr/include/linux/sched.h:14,
from /usr/src/linux-2.6.5-1.358/include/linux/module.h:10,
from hello.c:4:
/usr/include/linux/timex.h:148: error: field `time' has incomplete type
In file included from /usr/include/linux/signal.h:4,
from /usr/include/linux/sched.h:25,
from /usr/src/linux-2.6.5-1.358/include/linux/module.h:10,
from hello.c:4:
/usr/include/asm/signal.h:107: error: syntax error before "sigset_t"
/usr/include/asm/signal.h:110: error: syntax error before '}' token
In file included from hello.c:4:
/usr/src/linux-2.6.5-1.358/include/linux/module.h:15:25: linux/cache.h: No such file or directory
/usr/src/linux-2.6.5-1.358/include/linux/module.h:16:24: linux/kmod.h: No such file or directory
/usr/src/linux-2.6.5-1.358/include/linux/module.h:18:29: linux/stringify.h: No such file or directory
/usr/src/linux-2.6.5-1.358/include/linux/module.h:19:23: asm/local.h: No such file or directory
In file included from /usr/src/linux-2.6.5-1.358/include/linux/module.h:21,
from hello.c:4:
/usr/include/asm/module.h:4:2: warning: #warning Using kernel headers in userspace!
In file included from hello.c:4:
/usr/src/linux-2.6.5-1.358/include/linux/module.h:500: error: syntax error before "MOD_INC_USE_COUNT"
/usr/src/linux-2.6.5-1.358/include/linux/module.h:501: warning: return type defaults to `int'
/usr/src/linux-2.6.5-1.358/include/linux/module.h:512: error: syntax error before "MOD_DEC_USE_COUNT"
/usr/src/linux-2.6.5-1.358/include/linux/module.h:513: warning: return type defaults to `int'
hello.c: In function `init_module':
hello.c:19: warning: implicit declaration of function `printk'
hello.c:19: error: `KERN_DEBUG' undeclared (first use in this function)
hello.c:19: error: (Each undeclared identifier is reported only once
hello.c:19: error: for each function it appears in.)
hello.c:19: error: syntax error before string constant
hello.c: In function `cleanup_module':
hello.c:25: error: `KERN_DEBUG' undeclared (first use in this function)
hello.c:25: error: syntax error before string constant
[root@PositekVoice hfc]# cat hello.c
|