我已经编写了一个自定义设备驱动程序作为树状内核模块.此设备驱动程序定义用户空间应用程序所需的一组ioctl.ioctl在自定义头文件中定义.
应该安装此头文件的标准位置是什么?应该这样/usr/include吗?或者可能是安装标准内核包含文件的位置相同?
我已阅读此问题,但它没有指定应安装自定义头文件的位置.
当我尝试编译此代码时:
void main()
{
float x;
x=6.5;
printf("Value of x is %f, address of x %ld\n", x, &x);
}
Run Code Online (Sandbox Code Playgroud)
它给了我这个错误:
pruebaso.c:在函数'main'中:
pruebaso.c:5:9:警告:内置函数'printf'的不兼容隐式声明[默认启用]
printf("x的值为%f,地址为x%ld \n",x和x);
^
pruebaso.c:5:9:警告:格式'%ld'需要类型为'long int'的参数,但参数3的类型为'float*'[-Wformat =]
我在另一个论坛上看到的解决方案是首先对一个无效指针进行转换:http: //www.linuxquestions.org/questions/programming-9/beginning-c-programming-how-to-print-memory-位置-printf的转换数-927305 /
但是做出这个改变,
printf("Value of x is %f, address of x %ld\n", (double)x, (void *)&x);
Run Code Online (Sandbox Code Playgroud)
现在给我一个警告:
pruebaso.c:在函数'main'中:
pruebaso.c:5:9:警告:内置函数'printf'的不兼容隐式声明[默认启用]
printf("x的值为%f,地址为x%ld \n",(double)x,(void*)&x);
^
pruebaso.c:5:9:警告:格式'%ld'需要类型为'long int'的参数,但参数3的类型为'void*'[-Wformat =]
如果有人解释我怎么能在没有得到警告的情况下解决它?
谢谢