error: function declaration isn’t a prototype [-Werror=strict-prototypes] static int kobject_test_e

时间:2021-08-13 17:49:09

编译内核模块时,遇到如下编译错误:

/home/stone/enjoylinux/video-code/6-2/1/kobject.c:68:12: error: function declaration isn’t a prototype [-Werror=strict-prototypes]
 

解决:

内核模块初始化函数static int kobject_test_init()要加上参数类型,如下:

static int kobject_test_init(void)即可。