完整报错:
error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] unlocked_ioctl: Demo_ioctl
我源代码如下:
/* Demo 设备的ioctl接口函数*/
int Demo_ioctl(struct inode * inode ,struct file * file ,unsigned int cmd, unsigned long data )
{
#ifdef Demo_DEBUG
printk("Demo_ioctrl[---kernel ---]");
#endif
return 0;
}
就是这个代码,我make函数一直是如上错误,但是对比了命名和函数连接是一模一样的,询问老师后可能就是版本问题【这个代码试用于16.04和14.04,不知道18.04改了啥】
需要把这串代码修改成如下:
/* Demo 设备的ioctl接口函数*/
long Demo_ioctl(struct file * file ,unsigned int cmd, unsigned long data )
{
#ifdef Demo_DEBUG
printk("Demo_ioctrl[---kernel ---]");
#endif
return 0;
}
然后make