Thread: module.h

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    4

    module.h

    I was trying to compile a program in ubuntu linux, but i wasnt able to find module.h in /usr/include/linux/
    Please help me
    ************************************************** ********
    compilation
    ************************************************** ********
    gcc -c hello.c
    hello.c:2:26: error: linux/module.h: No such file or directory

    ************************************************** ****
    source
    ************************************************** ****
    Code:
    #define MODULE
    #include <linux/module.h>
    int init_module (void) /* Loads a module in the kernel */
    {
    printk("Hello kernel n");
    return 0;
    }
    void cleanup_module(void) /* Removes module from kernel */
    {
    printk("GoodBye Kerneln");
    }
    ************************************************** *******

    Thx in advance

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Maybe you need to include a kernel development kit? Look for a package called linux-headers.


    By the way, this is a kernel module, not a program.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    4
    thx for your help. But can you tell me the package name. apt-get install ******
    yes i was trying to compile a module.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    No, I don't have Ubuntu, so I don't know. linux-headers is what it is called in Gentoo.

    Another thing to try: see if /usr/include contains a directory called linux-2.6.xx or kernel-headers-2.6.xx (where xx is the micro version of your kernel). If you find such a thing, make a symlink called linux to it.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed