Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
> Linux Kernel Newbie
nkhambal
post Jun 9 2005, 01:08 AM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 1
Joined: 9-June 05
Member No.: 5,098



Hi,

I just started learning Linux device driver programming. I have been trying to compile this "hello, world" program on Fedora Core 3. But I am unable to do so. Following is Code.

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

MODULE_LICENSE("Dual BSD/GPL");

static int hello_init(void)
{
       printk(KERN_ALERT "HELLO, WORLDn");
       return 0;
}

static void hello_exit(void)
{
       printk(KERN_ALERT "GOOD BYE, WORLDn");
}

module_init(hello_init);
module_exit(hello_exit);


When I compile I get following errors

[quote]
[root@devlinux snoopy]# gcc -c mod1.c
mod1.c: In function `hello_init':
mod1.c:9: error: `KERN_ALERT' undeclared (first use in this function)
mod1.c:9: error: (Each undeclared identifier is reported only once
mod1.c:9: error: for each function it appears in.)
mod1.c:9: error: syntax error before string constant
mod1.c: In function `hello_exit':
mod1.c:15: error: `KERN_ALERT' undeclared (first use in this function)
mod1.c:15: error: syntax error before string constant
[root@devlinux snoopy]#
[/quote]

Can someone help me with this problem ?

Following is my Kernel Version

[quote]
[root@devlinux snoopy]# uname -a
Linux devlinux 2.6.9-1.667 #1 Tue Nov 2 14:41:25 EST 2004 i686 i686 i386 GNU/Linux
[root@devlinux snoopy]#
[/quote]

and my gcc version
[quote]
[root@devlinux snoopy]# gcc -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)
[root@devlinux snoopy]#
[/quote]
Go to the top of the page
 
+Quote Post

Posts in this topic
- nkhambal   Linux Kernel Newbie   Jun 9 2005, 01:08 AM
- - Corey   I'm no programmer, but i've dabbled in C f...   Jun 13 2005, 06:26 AM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 16th October 2017 - 05:02 PM