Linux设备驱动程序安装fatal error: linux/module.h: No such file or directory

在做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"
#define BUF_LEN 50

static int Device_Op
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值