Implicit declaration of printk

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

 



Good morning. I face the following problem...

I am trying to compile this simple module

#ifndef MODULE /*Makes code portable for the 2.4
series */
# define MODULE
#endif

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

static int __init initmodule(void)
{
        printk("<1> Hello, world 4\n");
        return 0;
}

static void __exit cleanupmodule(void)
{
        printk("<1> Goodbye, world 4\n");
}

module_init(initmodule);
module_exit(cleanupmodule);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Mickey Mouse");
MODULE_DESCRIPTION("Description goes here");


I compile it with the command
gcc  -c -O2 -W -Wall -Wstrict-prototypes
-Wmissing-prototypes -isystem
/lib/modules/2.4.25/build/include -DMODULE -D__KERNEL
first.c


The problem is that a warning is displayed


first.c: In function `initmodule':
first.c:11: warning: implicit declaration of function
`printk'


I have searched aroung google but nothing like my
mistake.... I want to know what else to do except
killing myself.
Also.. why the warning appear only for the init
function and not for the exit?
~



		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com 

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux