LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-11-2008, 09:56 AM   #1
woodyblue
LQ Newbie
 
Registered: May 2008
Posts: 2

Rep: Reputation: 0
Smile Help!How to solve this error-about module.h missing problem


I am a biginner in module programming, and I'm trying to study the module programming by some examples, so I got a simple copy as follow:
////////////////////
//test.c

#include <linux/kernel.h>
#include <linux/module.h>

#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif

int init_module()
{
printk("Hello!This is testing module");
return 0;
}

void cleanup_module()
{
printk("Sorry!The testing module is unloading now!");
}
//end of the program
/////////////////////
after I compiled it by command:

[root@localhost tian]# gcc -O2 -Wall -DMODULE -D__KERNEL__ -c test.c
test.c:2:26: error: linux/module.h: No such file or directory
test.c: In function 鈏nit_module?
test.c:11: warning: implicit declaration of function 鈖rintk?

I have checked for many comments, still not solved
and I need your help for that and I will much appreciate of you
 
Old 05-11-2008, 12:00 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156
You might be missing a package called linux-headers or kernel-headers depending
on your distro.
'linux/module.h' will be in /usr/include/
A nice thing to do, is to put the name of your distro into your profile here at LQ.
Rgds
 
Old 05-12-2008, 01:26 AM   #3
digvijay.gahlot
Member
 
Registered: Mar 2008
Posts: 53

Rep: Reputation: 15
Se page 10 of http://lwn.net/images/pdf/LDD3/ch02.pdf
Use a makefile.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Dns can't solve ..... Dude101 Feather 5 01-27-2008 05:56 PM
yum error: missing dependency problem brusel Linux - Enterprise 1 01-09-2008 06:19 AM
How to solve this Error message jmfa59 Linux - Newbie 3 07-03-2007 09:32 AM
rpmDB error - How to solve problem? arindom Linux - Desktop 2 12-25-2006 07:06 AM
How To Solve The Kernel Module Version Mismatch Problem ? linu_soft Programming 2 07-21-2004 05:47 AM


All times are GMT -5. The time now is 12:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration