Compiling issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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");
   /* A non 0 return means init_module failed; module can't be loaded. */
   return 0;
}

void cleanup_module(void){
  printk("<1>Goodbye world 1.\n");
}

when I comile 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.
-- 
View this message in context: http://www.nabble.com/Compiling-issue-tp23926919p23926919.html
Sent from the gcc - Help mailing list archive at Nabble.com.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux