macro ”**” requires 2 arguments, but only 1 given

本文介绍了在使用宏“ioremap”时遇到的一个常见问题:宏要求两个参数,但只提供了一个。通过排查发现,问题源于全角逗号的误用。文章提供了两种解决方案:一是定位并阻止宏定义的发生;二是使用预处理器指令解除宏定义。

遇到一个问题,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)的逗号打成了全角符号。导致函数认为只有一个参数。

像这种情况,一般有两种可能:

  • 字符编码错误,导致参数列表不符合函数定义
  • 使用的函数被某个头文件宏定义过

转载于:https://my.oschina.net/lvyi/blog/303078

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值