1、warning: function declaration isn't a prototype
定义函数:
void pack_up();
{
...
}
对以上程序,在编译驱动的时候会出现以下warning:
解决办法:即使函数括号内没有任何参数,也要加一个void类型,来避免这种warning。
2、warning: assignment from incompatible pointer type
char *header;
header = &bulk_header; //bulk_header为结构体
以上代码,header = &bulk_header; 赋值号左边是二重指针,赋值号右边的是一重指针,因此赋值不兼容(assignment from incompatible pointer type);
解决:header = bulk_header;
3、warning: ISO C90 forbids mixed declarations and code
在编写linux驱动的时候在一个函数的前边首先把这个函数中所需的所有变量一并定义完,就不会出现此错误。
4、comparison of distinct pointer types lacks a cast
两个不一样的指针类型进行比较操作,则会引起编译器产生一个编译警告,提示你这两个值的类型不同。
5、error: implicit declaration of function
在函数所在的c文件中定义了,但是没有在与之相关联的.h文件中声明。