[PLUG] gcc compilation issue
abhi
abhi.elementx at gmail.com
Mon Jun 8 21:36:22 IST 2009
Hi all. I am trying to learn writing linux modules. I am referring to a book
for writing the modules in C.
my code is :
/*hello-1.c*/
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_ALERT */
int init_module(void){
printk("<1>Hello world 1.\n");
return 0;
}
void cleanup_module(void){
printk("<1>Goodbye world 1.\n");
}
when I compile this using :
$ gcc -c hello-1.c
It says :
hello-1.c:4:55: error: linux/module.h: No such file or directory
hello-1.c: In function ‘cleanup_module’:
hello-1.c:19: error: ‘KERN_ALERT’ undeclared (first use in this function)
hello-1.c:19: error: (Each undeclared identifier is reported only once
hello-1.c:19: error: for each function it appears in.)
hello-1.c:19: error: expected ‘)’ before string constant
how do i solve this?
Thank you.
--
To laugh often and much; to win the respect of intelligent people and the
affection of children; to earn the appreciation of honest critics and endure
the betrayal of false friends; to appreciate beauty, to find the best in
others; to leave the world a little better; whether by a healthy child, a
garden patch of a redeemed social condition; to know that one life has
breathed easier because you have lived. This is the meaning of SUCCESS.
-Ralph Waldo Emerson
More information about the Plug-mail
mailing list