差之毫厘,谬以千里

今天在编一段代码的时候,遇到一个很奇怪的报错:
In file included from include/asm-generic/int-ll64.h:10:0,
                 from /home/charles/code/linux-3.10.28/include/uapi/asm-generic/types.h:7,
                 from arch/arm/include/generated/asm/types.h:1,
                 from include/uapi/linux/types.h:4,
                 from include/linux/types.h:5,
                 from include/linux/list.h:4,
                 from include/linux/module.h:9,
                 from /home/charles/code/modules/testproc.c:5:
include/uapi/asm-generic/int-ll64.h:19:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'
 typedef __signed__ char __s8;
 ^
In file included from include/linux/list.h:4:0,
                 from include/linux/module.h:9,
                 from /home/charles/code/modules/testproc.c:5:
include/linux/types.h:98:1: error: unknown type name '__s8'
 typedef  __s8  int8_t;
 ^
In file included from include/linux/quota.h:42:0,
                 from include/linux/fs.h:245,
                 from include/linux/proc_fs.h:8,
                 from /home/charles/code/modules/testproc.c:6:
/home/charles/code/linux-3.10.28/include/uapi/linux/dqblk_xfs.h:51:2: error: unknown type name '__s8'
  __s8  d_version; /* version of this structure */
  ^
/home/charles/code/linux-3.10.28/include/uapi/linux/dqblk_xfs.h:52:2: error: unknown type name '__s8'
  __s8  d_flags; /* FS_{USER,PROJ,GROUP}_QUOTA */
  ^
/home/charles/code/linux-3.10.28/include/uapi/linux/dqblk_xfs.h:153:2: error: unknown type name '__s8'
  __s8  qs_version; /* version number for future changes */
  ^
/home/charles/code/linux-3.10.28/include/uapi/linux/dqblk_xfs.h:155:2: error: unknown type name '__s8'
  __s8  qs_pad;  /* unused */

这些报错完全是在内核代码里的,查了半天也没找出问题。。

后来看了下自己的代码,发现在一个注释行开头,多了个字母 i...

<strong><span style="color:#FF0000;">i</span></strong>/*This program is used to allocate memory in kernel
and pass the physical address to userspace through proc file.*/

#include <linux/version.h>
#include <linux/module.h>
#include <linux/proc_fs.h>
#include <linux/mm.h>


去掉之后,上面的问题就没了。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值