Hinko Kocevar wrote:
Hi,
I'm reading LDD2 and trying to compile sample code as I go along, unfortunately I stumbled on some errors at the very first hello.c module. I'm running suse9, with latest kernel and sources installed (2.4.21-231).
Compiling with: gcc -c hello.c Attached are my hello world module and corresponding error output:
#define MODULE #include <linux/module.h>
int init_module (void) { printk("<1>Hello, World!\n");
return 0; }
void cleanup_module(void) { printk("<1>Goodbye, cruel world!\n"); }
regards, H
------------------------------------------------------------------------
In file included from /usr/include/linux/sched.h:12, from /usr/include/linux/module.h:9, from hello.c:3: /usr/include/linux/jiffies.h:16: error: parse error before "jiffies_64" /usr/include/linux/jiffies.h:20: error: parse error before "get_jiffies_64" In file included from /usr/include/linux/sched.h:20, from /usr/include/linux/module.h:9, from hello.c:3: /usr/include/asm/mmu.h:13: error: field `sem' has incomplete type In file included from /usr/include/linux/signal.h:4, from /usr/include/linux/sched.h:24, from /usr/include/linux/module.h:9, from hello.c:3: /usr/include/linux/list.h:563:2: warning: #warning "don't include kernel headers in userspace" In file included from /usr/include/asm/siginfo.h:4, from /usr/include/linux/signal.h:7, from /usr/include/linux/sched.h:24, from /usr/include/linux/module.h:9, from hello.c:3: /usr/include/asm-generic/siginfo.h:49: error: size of array `_pad' is too large In file included from /usr/include/linux/sched.h:26, from /usr/include/linux/module.h:9, from hello.c:3: /usr/include/linux/fs_struct.h:9: error: parse error before "rwlock_t" /usr/include/linux/fs_struct.h:13: error: parse error before '}' token In file included from /usr/include/linux/sched.h:28, from /usr/include/linux/module.h:9, from hello.c:3: /usr/include/linux/completion.h:15: error: parse error before "wait_queue_head_t" /usr/include/linux/completion.h: In function `init_completion': /usr/include/linux/completion.h:26: error: dereferencing pointer to incomplete type /usr/include/linux/completion.h:27: error: dereferencing pointer to incomplete type In file included from /usr/include/linux/sched.h:29, from /usr/include/linux/module.h:9, from hello.c:3: /usr/include/linux/pid.h: At top level: /usr/include/linux/pid.h:18: error: field `task_list' has incomplete type /usr/include/linux/pid.h:19: error: field `hash_chain' has incomplete type /usr/include/linux/pid.h:24: error: field `pid_chain' has incomplete type In file included from /usr/include/linux/sched.h:30, from /usr/include/linux/module.h:9, from hello.c:3: /usr/include/linux/percpu.h: In function `__alloc_percpu': /usr/include/linux/percpu.h:46: error: `GFP_KERNEL' undeclared (first use in this function) /usr/include/linux/percpu.h:46: error: (Each undeclared identifier is reported only once /usr/include/linux/percpu.h:46: error: for each function it appears in.) In file included from /usr/include/linux/sched.h:101, from /usr/include/linux/module.h:9, from hello.c:3: /usr/include/linux/timer.h: At top level: /usr/include/linux/timer.h:10: error: field `entry' has incomplete type
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/