../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h(97): error: #101: “DMA1_Channel5_IRQn“ h

在自己的文件里调用HAL库的文件时出现了大量报错比如30个报错之类的

"ws2812b\ws2812b.axf" - 30 Error(s), 3 Warning(s).

我的头文件是这样的

以下是报错

../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.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/stm32f103xb.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/stm32f103xb.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/stm32f103xb.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/stm32f103xb.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/stm32f103xb.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/stm32f103xb.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/stm32f103xb.h(103): error:  #101: "CAN1_RX1_IRQn" has already been declared in the current scope
    CAN1_RX1_IRQn               = 21,     /*!< CAN1 RX1 Interrupt                                   */
..\User\WS2812B.c: 3 warnings, 30 errors
"ws2812b\ws2812b.axf" - 30 Error(s), 3 Warning(s).
Target not created.
Build Time Elapsed:  00:00:00

解决方法是 :

去掉重复包含的头文件:#include "stm32f10x.h"                  // Device header
因为  #include "tim.h"   里面已经有包含  #include "stm32f10x.h"    了
 

我遇到了如下报错10:39:59 **** Incremental Build of configuration Debug for project test1 **** make -j12 all arm-none-eabi-gcc "../Core/Src/main.c" -mcpu=cortex-m3 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F103xB -c -I../Core/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Core/Src/main.d" -MT"Core/Src/main.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Core/Src/main.o" arm-none-eabi-gcc "../Core/Src/n3310.c" -mcpu=cortex-m3 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F103xB -c -I../Core/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Core/Src/n3310.d" -MT"Core/Src/n3310.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Core/Src/n3310.o" ../Core/Src/main.c: In function &#39;main&#39;: ../Core/Src/main.c:105:9: warning: implicit declaration of function &#39;RCC_APB2PeriphClockCmd&#39; [-Wimplicit-function-declaration] 105 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); | ^~~~~~~~~~~~~~~~~~~~~~ ../Core/Src/n3310.c: In function &#39;LcdInit&#39;: ../Core/Src/n3310.c:22:9: warning: implicit declaration of function &#39;RCC_APB2PeriphClockCmd&#39; [-Wimplicit-function-declaration] 22 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); | ^~~~~~~~~~~~~~~~~~~~~~ ../Core/Src/main.c:105:32: error: &#39;RCC_APB2Periph_AFIO&#39; undeclared (first use in this function) 105 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); | ^~~~~~~~~~~~~~~~~~~ ../Core/Src/main.c:105:32: note: each undeclared identifier is reported only once for each function it appears in ../Core/Src/n3310.c:22:32: error: &#39;R
最新发布
03-23
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值