Hi Taps,

On Wed, Aug 18, 2010 at 9:12 AM, Tapas Mishra <[email protected]> wrote:
> I wrote following program in my home directory.
...snip...
gcc -Wall -DMODULE -D__KERNEL__  -DLINUX -c sample2.c[/code]
...snip...
> What is the above error and why is it coming?
> I did all this in my home directory.

You're trying to compile your program as if it were a user-mode
program rather than a kernel module.

You'll need to install the kernel sources, or at a very minimum the
kernel headers.

You may want to take a look at Robert PJ Day's crashcourse:
http://crashcourse.ca/introduction-linux-kernel-programming/lesson-4-writing-and-running-your-first-kernel-module

The first 4 lessons are free and if you follow all the steps (start at
the beginnning) you'll get to the point where you can compile a linux
kernel module.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.DaveHylands.com/

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to