遇到一个问题,macro ”ioremap” requires 2 arguments, but only 1 given
http://stackoverflow.com/questions/518517/macro-max-requires-2-arguments-but-only-1-given 上面有解答
You're including a header file somewhere that #defines max as a macro. The best solution would be to figure out where it's being defined, and inhibit it from being defined if possible. Alternatively, you could just #undef it:
#include <evil_header_which_defines_max.h>
#undef max
最后发现是因为在ioremap的函数里,ioremap(INT_REG_START,0x1C)的逗号打成了全角符号。导致函数认为只有一个参数。
像这种情况,一般有两种可能:
- 字符编码错误,导致参数列表不符合函数定义
- 使用的函数被某个头文件宏定义过
本文介绍了在使用宏“ioremap”时遇到的一个常见问题:宏要求两个参数,但只提供了一个。通过排查发现,问题源于全角逗号的误用。文章提供了两种解决方案:一是定位并阻止宏定义的发生;二是使用预处理器指令解除宏定义。

953

被折叠的 条评论
为什么被折叠?



