- Makefile:1: *** missing separator. Stop
long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
所以修改源文件中file_operations内.ioctl 改为 .compat_ioctl 即可
8.error: negative width in bit-field ‘<anonymous>’
权限问题,尝试降低权限
9.error: 'TASK_INTERRUPTIBLE' undeclared
原因缺少头文件 #include <linux/sched.h> 添加后即可通过编译
10.hexdump: /dev/event0: No such file or directory
看看是不是在/dev/input/event0,而不是/dev/下
11.switch 中提示Expected expression before..."
除了检查switch和case之外,注意case后面的宏在定义的时候是不是加了;
12.file_operation中的方法实现不加static会提示重复定义。
13.
grep "key" xxx.log时输出
Binary file xxx.log matches
百度了一下:grep认为这是二进制文件,解决方案:grep -a。
grep -a "key" xxx.log
14.useless storage class specifier in empty declaration
struct item {
char *text;
int count;
struct item *next;
};
修改为:typedef struct item {
char *text;
int count;
struct item *next;
}item;