I run gcc -I/lib/modules/`uname -r`/build/include hello.c, and get following error messages: --------- message begin -------------- In file included from /lib/modules/2.4.18-14/build/include/linux/config.h:4, from /lib/modules/2.4.18-14/build/include/linux/module.h:10, from hello.c:5: /usr/include/linux/autoconf.h:1:2: #error Invalid kernel header included in userspace In file included from /lib/modules/2.4.18-14/build/include/linux/module.h:25, from hello.c:5: /usr/include/asm/atomic.h:40:2: warning: #warning Using kernel header in userland program. BAD! --------- message end -------------- It seems that I cannot do it this way. How can I choose which kernel version files to compile? Ben --- Arjan van de Ven <arjanv@redhat.com> wrote: > On Wed, 2003-05-07 at 21:20, Bluesea wrote: > > I used "insmod" to install a modul which was > compiled > > with "gcc" under RH 8.0, and got the following > > message: > > > > ./hello.o: kernel-module version mismatch > > ./hello.o was compiled for kernel version > 2.4.9-9 > > while this kernel is version 2.4.18-14 > > > > So I think my compiler is for kernel version > 2.4.9-9 > > nah > you used the glibc headers for compiling your kernel > module, not the > kernel headers. Add > -I/lib/modules/`uname -r`/build/include > to your gcc commandline to use the kernel headers > instead. > > ATTACHMENT part 2 application/pgp-signature name=signature.asc __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/