Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I am new to linux kernel programming. I created small program when i compiled i am getting the following error undefined refrence to 'printk' Please can some one suggest ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2008
    Posts
    3

    Angry Error:=undefined refrence to 'printk'


    Hi,
    I am new to linux kernel programming.

    I created small program when i compiled i am getting the following error
    undefined refrence to 'printk'

    Please can some one suggest what could be the problem?
    Here is is the program:
    ##############################
    #include<linux/fs.h>
    #include<linux/module.h>
    #include<linux/kernel.h>
    #include<linux/init.h>

    MODULE_LICENCE("GPL")

    static int initialization(void)
    {
    printk("Hello world\n");
    }

    static void clean_up(void)
    {
    printk("Clean up\n");
    }

    module_init(initialization);
    module_exit(clean_up);
    ###############################

  2. #2
    Just Joined!
    Join Date
    Mar 2008
    Location
    Hyderabad
    Posts
    20

    Module license spelling wrong

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

    static int initialization(void)
    {
    printk("Hello world\n");
    return 0;
    }

    static void clean_up(void)
    {
    printk("Clean up\n");
    }
    MODULE_LICENSE("GPL")
    module_init(initialization);
    module_exit(clean_up)

  3. #3
    Just Joined!
    Join Date
    Oct 2008
    Posts
    3
    It was typing error when i posted, The error i was getting because of different reason i felt, when i analyzed.
    I installed Fedora-6 Linux, where i need to install kernel-devel package separately.

    This link talks about the installation package.
    Fedora Project, sponsored by Red Hat

    2) It was not having this problem with earlier version of Fedora.
    Thank you for your help Venkat.

    thanks
    Sridhar

  4. #4
    Just Joined!
    Join Date
    Mar 2008
    Location
    Hyderabad
    Posts
    20

    if any version spelling doesn't change.

    MODULE_LICENSE("GPL")
    Correct spelling.
    Any way you have compiling with out error right
    ok
    thanks,
    --Venkatesh.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •