LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-06-2004, 11:41 PM   #1
mishranavaneet
LQ Newbie
 
Registered: Jan 2004
Location: Pune, Mharashtra, India
Posts: 4

Rep: Reputation: 0
kernel progarmmer's(module compiletion problem)==> full detail<==


==> i try to compile this module code form root password
=========
hello.c
=========
/* hello.c - The simplest kernel module.
*/
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_ALERT */
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif
int init_module(void)
{
printk("Hello world 1.\n");
// A non 0 return means init_module failed; module can't be loaded.
return 0;
}
void cleanup_module(void)
{
printk("Goodbye world 1.\n");
}


==>for compiling this module i use a bash file that contain's
==========
compiling
==========
hello.o: hello.c /usr/include/linux/version.h
gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c hello.c


==> but these error's are come
================
error i
================
hello.o:: command not found
In file included from hello.c:3:
/usr/include/linux/module.h:60: parse error before `atomic_t'
/usr/include/linux/module.h:60: warning: no semicolon at end of struct or union
/usr/include/linux/module.h:60: warning: no semicolon at end of struct or union
/usr/include/linux/module.h:62: parse error before `}'
/usr/include/linux/module.h:62: warning: data definition has no type or storage class
/usr/include/linux/module.h:91: parse error before `}'
hello.c: In function `init_module':
hello.c:11: warning: implicit declaration of function `printk'


==> i m using RH7.3 kernel 2.4.18.3 please help me for solving this problem
 
Old 01-07-2004, 01:04 AM   #2
shishir
Member
 
Registered: Jul 2003
Location: bangalore . india
Distribution: openSUSE 10.3
Posts: 251

Rep: Reputation: 33
try compiling it with
gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c hello.c -I /usr/src/<linux-2.x.x>/include -nostdinc

would work fine..

you are not supposed to be picking up user land header files that are there in /usr/include
 
  


Reply



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
Problem installing module in Fedora Core 2 (2.6 kernel vs 2.4 problem?) Arodef Linux - Kernel 3 11-30-2007 02:55 PM
Kernel 2.6.13 and module problem jeffpr Fedora 3 10-07-2005 05:22 PM
kernel progarmmer's(module compiletion problem) mishranavaneet Programming 7 08-13-2004 11:37 PM
"Invalid module format" after FULL kernel recompile RedDwarf Linux - General 6 08-07-2004 07:46 PM
Kernel 2.4.23 module problem powadha Linux - Software 2 12-09-2003 06:28 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:20 AM.

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
Open Source Consulting | Domain Registration