【问题标题】:Linux Kernel error: missing binary operator before token "("Linux内核错误:令牌“(”之前缺少二元运算符
【发布时间】:2019-04-01 13:43:34
【问题描述】:

Linux Kernel 模块中的一些简单预处理器代码给出以下错误:

在标记“(”之前缺少二元运算符

代码:

#if defined(AAA) || defined(BBB)

#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,13,0)
#define SOME 111
#else
#define SOME 222
#endif

#define OTHER 999

#else

#define SOME 1
#define OTHER 9

#endif /* AAA || BBB */

That post 没有帮助。

【问题讨论】:

  • 使用gcc -E 来确定它扩展为什么。

标签: c linux-kernel c-preprocessor kernel-module


【解决方案1】:

该错误意味着未定义 KERNEL_VERSION

你错过了#include &lt;linux/version.h&gt;


编辑

关于内核版本另见:Is there a macro definition to check the Linux kernel version?

【讨论】:

    猜你喜欢
    • 2017-06-27
    • 1970-01-01
    • 1970-01-01
    • 2014-02-15
    • 1970-01-01
    • 1970-01-01
    • 2022-11-13
    • 2021-10-21
    • 1970-01-01
    相关资源
    最近更新 更多