Linux内核错误:令牌之前缺少二元运算符“(”

问题描述 投票:1回答:1

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没有帮助。

c linux-kernel c-preprocessor kernel-module
1个回答
4
投票

该错误意味着未定义KERNEL_VERSION

你错过了#include <linux/version.h>


编辑

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

© www.soinside.com 2019 - 2024. All rights reserved.