错误:函数“create_proc_read_entry"的隐式声明 [-Werror=implicit-function-declaration] [英] error: implicit declaration of function 'create_proc_read_entry' [-Werror=implicit-function-declaration]

查看:18
本文介绍了错误:函数“create_proc_read_entry"的隐式声明 [-Werror=implicit-function-declaration]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在内核 3.13 上编译内核模块,但出现此错误:

I'm trying to compile a kernel module on kernel 3.13 and I get this error:

error: implicit declaration of function 'create_proc_read_entry' [-Werror=implicit-function-declaration] 

我谷歌了一下,没有找到任何回应.这是引用此错误的代码部分:

I google it and did not found any response. Here is the part of the code which refers to this error:

#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
    proc = proc_net_create(KAODV_QUEUE_PROC_FS_NAME, 0, kaodv_queue_get_info);
#else
    proc = create_proc_read_entry(KAODV_QUEUE_PROC_FS_NAME, 0, init_net.proc_net, kaodv_queue_get_info, NULL);
#endif
    if (!proc) {
      printk(KERN_ERR "kaodv_queue: failed to create proc entry
");
      return -1;
    }

我能得到帮助吗?我真的不知道出了什么问题.可能是内核 3.13 需要补丁.我在某处(在 KERNEL 3.10 上)读到内核需要补丁.谁能告诉我在哪里可以获得 3.13 内核补丁以最终解决问题.谢谢

Can I get help ? I really don't know what is wrong. It might be the kernel 3.13 which needs a patch. I read somewhere (on KERNEL 3.10) that the kernel needs patch. Can anyone show me where can I get the 3.13 kernel patch to eventually fix the problem. Thanks

推荐答案

该错误是因为您没有明确包含声明函数的标头,并且编译器为您隐式地包含",这会引发警告.标志-Werror"使编译器将警告视为错误.尝试添加:#include

The error is because you are not including explicitly the header that declares the function and the compiler is 'including' implicitily for you and this throws a warning. The flag '-Werror' is making the compiler treats the warning as an error. Try adding: #include <linux/proc_fs.h>

另外:create_proc_read_entry 是一个不推荐使用的函数.

Also: create_proc_read_entry is a deprecated function.

看一看:https://lkml.org/lkml/2013/4/11/215

这篇关于错误:函数“create_proc_read_entry"的隐式声明 [-Werror=implicit-function-declaration]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆