在做Linux设备驱动程序安装实验时,执行gcc -c mydev.c产生fatal error: linux/module.h: No such file or directory错误信息
mydev.c代码如下:
#ifndef __KERNEL__
#define __KERNEL__
#endif
#ifndef MODULE
#define MODULE
#endif
#define __NO_VERSION__
#include<linux/kernel.h>
#include<linux/module.h>
#include<linux/version.h>
#include<linux/config.h>
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include<linux/modversions.h>
#endif
#include<linux/fs.h>
#include<linux/wrapper.h>
#include<linux/types.h>
#include<asm/segment.h>
#ifndef KERNEL_VERSION
#define KERNEL_VERSION(a,b,c) ((a)*65535+(b)*256+(c))
#endif
/*Conditional compilation. LINUX_VERSION_CODE is
* the code (as per KERNEL_VERSION) of this version.
*/
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
#include <asm/uaccess.h> /*for put_user*/
#endif
#define SUCCESS 0
#define DEVICE_NAME "kueng_char_dev"
#d