一、问题背景
开发环境:Keil 5
芯片型号:STM32F103C8T6
库类型:HAL库
移植大彩串口屏驱动代码时,编译出现大量error:#101 错误,如下:
error: #101: "RTC_IRQn" has already been declared in the current scope
RTC_IRQn = 3, /*!< RTC global Interrupt */
error: #101: "FLASH_IRQn" has already been declared in the current scope
FLASH_IRQn = 4, /*!< FLASH global Interrupt */
error: #101: "RCC_IRQn" has already been declared in the current scope
RCC_IRQn = 5, /*!< RCC global Interrupt */
error: #101: "EXTI0_IRQn" has already been declared in the current scope
EXTI0_IRQn = 6, /*!< EXTI Line0 Interrupt */
error: #101: "EXTI1_IRQn" has already been declared in the current scope
EXTI1_IRQn = 7, /*!< EXTI Line1 Interrupt */
error: #101: "EXTI2_IRQn" has already been declared in the current scope
EXTI2_IRQn = 8, /*!< EXTI Line2 Interrupt */
提示错误出现的文件是stm32f10x.h;
二、解决办法
出现这种问题是由于代码中存在两个功能重复的头文件;
搜索stm32f10x.h
的位置;
把stm32f10x.h 替换成stm32f10x_hal.h就可以了