现在的位置: 首页 > 综合 > 正文

头文件#ifndef定义重复的宏也会出现 implicit declaration of function 错误

2013年10月20日 ⁄ 综合 ⁄ 共 529字 ⁄ 字号 评论关闭

案例:

Linux内核中

arch/arm/plat-s3c/include/plat/regs-otg.h

arch/arm/plat-s3c/include/plat/regs-usb-otg-hs.h

 

这两个头文件定义了相同的宏:

#ifndef __ASM_ARCH_REGS_USB_OTG_HS_H

 

make编译出现错误:

drivers/usb/gadget/s3c_udc_otg_xfer_dma.c:65: error: implicit declaration of function 'S3C_UDC_OTG_DIEPDMA'

......

drivers/usb/gadget/s3c_udc_otg_xfer_dma.c:152: error: 'DEPCTL_NEXT_EP_BIT' undeclared (first use in this function)

 

原因是头文件宏定义重复了,到时后面的一堆不该错误的问题。

 

把arch/arm/plat-s3c/include/plat/regs-otg.h中的

#ifndef __ASM_ARCH_REGS_USB_OTG_HS_H

改成

#ifndef __ASM_ARCH_REGS_USB_OTG_H

 

编译,所有问题解决。

抱歉!评论已关闭.