Keil编译报错[error: #101: “xxx_IRQn“ has already been declared in the current scope]解决办法

Keil编译报错解决办法

库类型:HAL库

突然出现大量报错

提示错误出现的文件是stm32f10x.h;

二、解决办法

出现这种问题是由于代码中存在两个功能重复的头文件
搜索stm32f10x.h的位置;
把stm32f10x.h 替换成stm32f10x_hal.h就可以了,或者去掉

问题:

第一张图:很多报错,

第二张图:跳转到第一个报错的位置

去掉:

将第一个空定义去掉,main.c里面已经有了

之后就好了

Build started: Project: Demo00 *** Using Compiler &#39;V5.06 update 6 (build 750)&#39;, folder: &#39;D:\My Projects\Work Softwares\Keil MDK\ARM\ARMCC\Bin&#39; Build target &#39;Demo00&#39; compiling OLED.c... ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(50): warning: #47-D: incompatible redefinition of macro "__MPU_PRESENT" (declared at line 163 of "D:\My Projects\Work Softwares\Keil MDK\Keil\STM32F1xx_DFP\2.3.0\Device\Include\stm32f10x.h") #define __MPU_PRESENT 0U /*!< Other STM32 devices does not provide an MPU */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(51): warning: #47-D: incompatible redefinition of macro "__NVIC_PRIO_BITS" (declared at line 165 of "D:\My Projects\Work Softwares\Keil MDK\Keil\STM32F1xx_DFP\2.3.0\Device\Include\stm32f10x.h") #define __NVIC_PRIO_BITS 4U /*!< STM32 uses 4 Bits for the Priority Levels */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(52): warning: #47-D: incompatible redefinition of macro "__Vendor_SysTickConfig" (declared at line 166 of "D:\My Projects\Work Softwares\Keil MDK\Keil\STM32F1xx_DFP\2.3.0\Device\Include\stm32f10x.h") #define __Vendor_SysTickConfig 0U /*!< Set to 1 if different SysTick Config is used */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(71): error: #101: "NonMaskableInt_IRQn" has already been declared in the current scope NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(73): error: #101: "MemoryManagement_IRQn" has already been declared in the current scope MemoryManagement_IRQn = -12, /*!< 4 Cortex-M3 Memory Management Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(74): error: #101: "BusFault_IRQn" has already been declared in the current scope BusFault_IRQn = -11, /*!< 5 Cortex-M3 Bus Fault Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(75): error: #101: "UsageFault_IRQn" has already been declared in the current scope UsageFault_IRQn = -10, /*!< 6 Cortex-M3 Usage Fault Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(76): error: #101: "SVCall_IRQn" has already been declared in the current scope SVCall_IRQn = -5, /*!< 11 Cortex-M3 SV Call Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(77): error: #101: "DebugMonitor_IRQn" has already been declared in the current scope DebugMonitor_IRQn = -4, /*!< 12 Cortex-M3 Debug Monitor Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(78): error: #101: "PendSV_IRQn" has already been declared in the current scope PendSV_IRQn = -2, /*!< 14 Cortex-M3 Pend SV Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(79): error: #101: "SysTick_IRQn" has already been declared in the current scope SysTick_IRQn = -1, /*!< 15 Cortex-M3 System Tick Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(82): error: #101: "WWDG_IRQn" has already been declared in the current scope WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(83): error: #101: "PVD_IRQn" has already been declared in the current scope PVD_IRQn = 1, /*!< PVD through EXTI Line detection Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(84): error: #101: "TAMPER_IRQn" has already been declared in the current scope TAMPER_IRQn = 2, /*!< Tamper Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(85): error: #101: "RTC_IRQn" has already been declared in the current scope RTC_IRQn = 3, /*!< RTC global Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(86): error: #101: "FLASH_IRQn" has already been declared in the current scope FLASH_IRQn = 4, /*!< FLASH global Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(87): error: #101: "RCC_IRQn" has already been declared in the current scope RCC_IRQn = 5, /*!< RCC global Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(88): error: #101: "EXTI0_IRQn" has already been declared in the current scope EXTI0_IRQn = 6, /*!< EXTI Line0 Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(89): error: #101: "EXTI1_IRQn" has already been declared in the current scope EXTI1_IRQn = 7, /*!< EXTI Line1 Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(90): error: #101: "EXTI2_IRQn" has already been declared in the current scope EXTI2_IRQn = 8, /*!< EXTI Line2 Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(91): error: #101: "EXTI3_IRQn" has already been declared in the current scope EXTI3_IRQn = 9, /*!< EXTI Line3 Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(92): error: #101: "EXTI4_IRQn" has already been declared in the current scope EXTI4_IRQn = 10, /*!< EXTI Line4 Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(93): error: #101: "DMA1_Channel1_IRQn" has already been declared in the current scope DMA1_Channel1_IRQn = 11, /*!< DMA1 Channel 1 global Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(94): error: #101: "DMA1_Channel2_IRQn" has already been declared in the current scope DMA1_Channel2_IRQn = 12, /*!< DMA1 Channel 2 global Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(95): error: #101: "DMA1_Channel3_IRQn" has already been declared in the current scope DMA1_Channel3_IRQn = 13, /*!< DMA1 Channel 3 global Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(96): error: #101: "DMA1_Channel4_IRQn" has already been declared in the current scope DMA1_Channel4_IRQn = 14, /*!< DMA1 Channel 4 global Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(97): error: #101: "DMA1_Channel5_IRQn" has already been declared in the current scope DMA1_Channel5_IRQn = 15, /*!< DMA1 Channel 5 global Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(98): error: #101: "DMA1_Channel6_IRQn" has already been declared in the current scope DMA1_Channel6_IRQn = 16, /*!< DMA1 Channel 6 global Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(99): error: #101: "DMA1_Channel7_IRQn" has already been declared in the current scope DMA1_Channel7_IRQn = 17, /*!< DMA1 Channel 7 global Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(100): error: #101: "ADC1_2_IRQn" has already been declared in the current scope ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(101): error: #101: "USB_HP_CAN1_TX_IRQn" has already been declared in the current scope USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(102): error: #101: "USB_LP_CAN1_RX0_IRQn" has already been declared in the current scope USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */ ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h(103): error: #101: "CAN1_RX1_IRQn" has already been declared in the current scope CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */ ..\Core\Src\OLED.c: 3 warnings, 30 errors "Demo00\Demo00.axf" - 30 Error(s), 3 Warning(s). Target not created. Build Time Elapsed: 00:00:01
最新发布
11-02
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值