undefined reference to printk()
hi to all,
i need to compile a small program that i made. WHen i try to do it, it compiles all right with the -c option ( that is i get the .o file), but if i do even the linking it just keep giving me the undefined reference error to some kernel functions that i need to use. In particular are the printk, filp_open, generic_file_read.... I have included the header files that declare them ( kernel.h and fs.h) and i have compiled the program with the -D__KERNEL__ and other option used by the compiler when it wants to compile a module in the kernel. I tried in many different ways but the error in the linking is always the same. thank you,
boba
_________________________________________________________________
MSN Foto è il modo più semplice per condividere e stampare le tue foto: http://photos.msn.com/support/worldwide.aspx
Quoted 4 lines · gio zanei
hi to all,
i need to compile a small program that i made. WHen i try to do it, it compiles all right with the -c option ( that is i get the .o file), but if i do even the linking it just keep giving me the undefined reference error to
Quoted 9 lines
some kernel functions that i need to use. In particular are the printk,
filp_open,generic_file_read.... I have included the header files that declare them (kernel.handfs.h) and i have compiled the program with the -D__KERNEL__ and other option used by the compiler when it wants to compile a module in the kernel. I tried in many different ways but the error in the linking is always the same.
thank you,
boba
Stuff compiled to run in the kernel needs to be run in the kernel. Stuff compiled to run in user-mode needs to be run in user-mode. None the twain shall meet.
You can't make a 'program' that calls kernel functions. You make a module and install it. Modules are not linked as user-mode executables. They remain object files.
Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
Windows-2000/Professional isn't.