LDD 例子代码编译出错,出错信息如下,请求大侠指点。谢谢!

[复制链接]
查看11 | 回复5 | 2021-1-27 05:10:05 | 显示全部楼层 |阅读模式
make-C/lib/modules/4.13.0-36-generic/buildM=/home/kdt/LDD/ch8modules
make[1]:Enteringdirectory'/usr/src/linux-headers-4.13.0-36-generic'
CC[M]/home/kdt/LDD/ch8/globalfifo.o
/home/kdt/LDD/ch8/globalfifo.c:Infunction‘globalfifo_read’:
/home/kdt/LDD/ch8/globalfifo.c:108:7:error:implicitdeclarationoffunction‘signal_pending’[-Werror=implicit-function-declaration]
if(signal_pending(current)){
^
Infileincludedfrom./include/linux/printk.h:6:0,
from./include/linux/kernel.h:13,
from./include/linux/list.h:8,
from./include/linux/module.h:9,
from/home/kdt/LDD/ch8/globalfifo.c:9:
./include/linux/kern_levels.h:4:18:warning:format‘%d’expectsargumentoftype‘int’,butargument2hastype‘size_t{akalongunsignedint}’[-Wformat=]
#defineKERN_SOH"\001"/*ASCIIStartOfHeader*/
^
./include/linux/kern_levels.h:13:19:note:inexpansionofmacro‘KERN_SOH’
#define
分 -->
回复

使用道具 举报

千问 | 2021-1-27 05:10:05 | 显示全部楼层
几个错误啊,没用过LDD,来学习下
回复

使用道具 举报

千问 | 2021-1-27 05:10:05 | 显示全部楼层
#include
包含此头文件试下
回复

使用道具 举报

千问 | 2021-1-27 05:10:05 | 显示全部楼层
这不提示了吗?不兼容,编译额时候加上-Werror=implicit-function-declaration试试,
回复

使用道具 举报

千问 | 2021-1-27 05:10:05 | 显示全部楼层
根据报错信息,你的内核版本是4.13.0。这对于LDD3中的例程来说太新了。LDD3代码的时代,我印象里是内核2.X;我当时参照3.18.24的内核看的,就已经有很多函数/结构体不同了。
除非有对应版本的内核,否则不建议去编译LDD3的例程(因为内核版本不同,根本编不过)
我曾经看的时候,书中的接口,都是去较新的内核代码中去找找,学习一下新的怎么用。LDD3对于现在来说,内容还是不错的,就是老了点~
回复

使用道具 举报

千问 | 2021-1-27 05:10:05 | 显示全部楼层
引用3楼qq_36751214的回复:这不提示了吗?不兼容,编译额时候加上-Werror=implicit-function-declaration试试,
-Wno-implicit-function-declaration?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行