implicit declaration of function 'class_device_create'
编译内核驱动时经常会出现这样的错误:implicit declaration of function 'class_device_create'或者是implicit declaration of function 'class_device_destroy'
这种错误我以前也有提到过,只要把'class_device_create'改成'device_create','class_device_destroy'改成'device_destroy'一般就可以正确通过编译了。这主要是由内核版本决定的,那么我们怎样看一个内核到底是支持'class_device_create'还是'device_create',每次都这样尝试可能有点麻烦。
我们可以通过查看
路径下的device.h文件来看到底是支持哪个的。
下面是2.6.30内核的关于'device_create'的声明
如果内核声明的是'class_device_create',那么编写内核的时候就改成'class_device_create'就可以了。