Re: failing to compile ldd2 sample code

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

 



Hi

you probably need to include the path to the kernel headers on your gcc
command line (probably a good idea to turn some warnings on too)

gcc -c -Wall -I/path-to-kernel-src/include hello.c

for example I would for my system use the line

gcc -c -Wall -O2 -I/usr/src/linux-2.4/include hello.c


On Mon, 2004-07-19 at 17:33, Hinko Kocevar wrote:
> Hi,
> 
> I'm reading LDD2 and trying to compile sample code as I go along,
> unfortunately I stumbled on some errors at the very first hello.c
> module. I'm  running suse9, with latest kernel and sources installed
> (2.4.21-231).
> 
> Compiling with: gcc -c hello.c
> Attached are my hello world module and corresponding error output:
> 
> #define MODULE
> #include <linux/module.h>
> 
> 
> int init_module (void) {
>          printk("<1>Hello, World!\n");
> 
>          return 0;
> }
> 
> void cleanup_module(void) {
>          printk("<1>Goodbye, cruel world!\n");
> }
> 
> 
> 
> regards,
> H


--
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