*** Using Compiler 'V6.16', folder: 'd:\Keil_v5\ARM\ARMCLANG\Bin'
compiling main.c...
USER/main.c(8): warning: In file included from...
./USER/main.h(5): warning: In file included from...
./CMSIS\stm32f10x.h(271): error: missing ',' between enumerators
USBWakeUp_IRQn = 42 /*!< USB Device WakeUp from
suspend through EXTI Line Interrupt */
^
上面这个文件的271行没有加逗号。
./CMSIS\stm32f10x.h(301): warning: declaration shadows a variable in the global scope [-Wshadow]
ADC1_2_IRQn = 18,
/*!< ADC1 and ADC2 global Interrupt */
^
./CMSIS\stm32f10x.h(247): note: previous declaration is here
ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global
Interrupt */
^
./CMSIS\stm32f10x.h(301): error: redefinition of enumerator 'ADC1_2_IRQn'
ADC1_2_IRQn = 18, /*!< ADC1 and ADC2
global Interrupt */
^
./CMSIS\stm32f10x.h(247): note: previous definition is here
ADC1_2_IRQn =
18, /*!< ADC1 and ADC2 global Interrupt */
^
./CMSIS\stm32f10x.h(302): warning: declaration shadows a
variable in the global scope [-Wshadow]
USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts
*/
^
./CMSIS\stm32f10x.h(248): note: previous declaration is here
USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High
Priority or CAN1 TX Interrupts */
^
./CMSIS\stm32f10x.h(302): error: redefinition of enumerator 'USB_HP_CAN1_TX_IRQn'
USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
^
./CMSIS\stm32f10x.h(248): note:
previous definition is here
USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
^
./CMSIS\stm32f10x.h(303): warning: declaration shadows a variable in the global scope [-Wshadow]
USB_LP_CAN1_RX0_IRQn = 20,
/*!< USB Device Low Priority or CAN1 RX0 Interrupts */
^
./CMSIS\stm32f10x.h(249): note: previous declaration is here
USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
^
./CMSIS\stm32f10x.h(303): error:
redefinition of enumerator 'USB_LP_CAN1_RX0_IRQn'
USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0
Interrupts */
^
./CMSIS\stm32f10x.h(249): note: previous definition is here
USB_LP_CAN1_RX0_IRQn = 20, /*!< USB
Device Low Priority or CAN1 RX0 Interrupts */
^
./CMSIS\stm32f10x.h(304): warning: declaration shadows a variable in the global
scope [-Wshadow]
CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
^
./CMSIS
\stm32f10x.h(250): note: previous declaration is here
CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt
*/
^
./CMSIS\stm32f10x.h(304): error: redefinition of enumerator 'CAN1_RX1_IRQn'
CAN1_RX1_IRQn = 21,
/*!< CAN1 RX1 Interrupt */
^
./CMSIS\stm32f10x.h(250): note: previous definition is here
CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
^
./CMSIS\stm32f10x.h(305):
warning: declaration shadows a variable in the global scope [-Wshadow]
CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt
*/
^
./CMSIS\stm32f10x.h(251): note: previous declaration is here
CAN1_SCE_IRQn = 22,
/*!< CAN1 SCE Interrupt */
^
./CMSIS\stm32f10x.h(305): error: redefinition of enumerator
'CAN1_SCE_IRQn'
CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
^
./CMSIS
\stm32f10x.h(251): note: previous definition is here
CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt
*/
^
./CMSIS\stm32f10x.h(306): warning: declaration shadows a variable in the global scope [-Wshadow]
EXTI9_5_IRQn
= 23, /*!< External Line[9:5] Interrupts */
^
./CMSIS\stm32f10x.h(252): note: previous
declaration is here
EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
^
./CMSIS
\stm32f10x.h(306): error: redefinition of enumerator 'EXTI9_5_IRQn'
EXTI9_5_IRQn = 23, /*!< External Line[9:5]
Interrupts */
^
./CMSIS\stm32f10x.h(252): note: previous definition is here
EXTI9_5_IRQn = 23,
/*!< External Line[9:5] Interrupts */
^
./CMSIS\stm32f10x.h(307): warning: declaration shadows a variable in
the global scope [-Wshadow]
TIM1_BRK_IRQn = 24, /*!< TIM1 Break Interrupt */
^
./CMSIS\stm32f10x.h(253): note: previous declaration is here
TIM1_BRK_IRQn = 24, /*!< TIM1 Break Interrupt
*/
^
./CMSIS\stm32f10x.h(307): error: redefinition of enumerator 'TIM1_BRK_IRQn'
TIM1_BRK_IRQn =
24, /*!< TIM1 Break Interrupt */
^
./CMSIS\stm32f10x.h(253): note: previous definition is here
TIM1_BRK_IRQn = 24, /*!< TIM1 Break Interrupt */
^
./CMSIS\stm32f10x.h(308):
warning: declaration shadows a variable in the global scope [-Wshadow]
TIM1_UP_IRQn = 25, /*!< TIM1 Update
Interrupt */
^
./CMSIS\stm32f10x.h(254): note: previous declaration is here
TIM1_UP_IRQn
= 25, /*!< TIM1 Update Interrupt */
^
./CMSIS\stm32f10x.h(308): error: redefinition of enumerator
'TIM1_UP_IRQn'
TIM1_UP_IRQn = 25, /*!< TIM1 Update Interrupt */
^
./CMSIS
\stm32f10x.h(254): note: previous definition is here
TIM1_UP_IRQn = 25, /*!< TIM1 Update Interrupt
*/
^
./CMSIS\stm32f10x.h(309): warning: declaration shadows a variable in the global scope [-Wshadow]
TIM1_TRG_COM_IRQn = 26, /*!< TIM1 Trigger and Commutation Interrupt */
^
./CMSIS\stm32f10x.h(255): note:
previous declaration is here
TIM1_TRG_COM_IRQn = 26, /*!< TIM1 Trigger and Commutation Interrupt */
^
./CMSIS\stm32f10x.h(309): error: redefinition of enumerator 'TIM1_TRG_COM_IRQn'
TIM1_TRG_COM_IRQn = 26, /*!< TIM1
Trigger and Commutation Interrupt */
^
./CMSIS\stm32f10x.h(255): note: previous definition is here
TIM1_TRG_COM_IRQn
= 26, /*!< TIM1 Trigger and Commutation Interrupt */
^
./CMSIS\stm32f10x.h(310): warning: declaration shadows
a variable in the global scope [-Wshadow]
TIM1_CC_IRQn = 27, /*!< TIM1 Capture Compare Interrupt
*/
^
./CMSIS\stm32f10x.h(256): note: previous declaration is here
TIM1_CC_IRQn = 27, /*!< TIM1 Capture Compare
Interrupt */
^
./CMSIS\stm32f10x.h(310): error: redefinition of enumerator 'TIM1_CC_IRQn'
TIM1_CC_IRQn
= 27, /*!< TIM1 Capture Compare Interrupt */
^
./CMSIS\stm32f10x.h(256): note: previous definition is
here
TIM1_CC_IRQn = 27, /*!< TIM1 Capture Compare Interrupt */
^
./CMSIS\stm32f10x.h(311):
warning: declaration shadows a variable in the global scope [-Wshadow]
TIM2_IRQn = 28, /*!< TIM2 global
Interrupt */
^
./CMSIS\stm32f10x.h(257): note: previous declaration is here
TIM2_IRQn
= 28, /*!< TIM2 global Interrupt */
^
./CMSIS\stm32f10x.h(311): error: redefinition of enumerator
'TIM2_IRQn'
TIM2_IRQn = 28, /*!< TIM2 global Interrupt */
^
./CMSIS\stm32f10x.h
(257): note: previous definition is here
TIM2_IRQn = 28, /*!< TIM2 global Interrupt
*/
^
./CMSIS\stm32f10x.h(312): warning: declaration shadows a variable in the global scope [-Wshadow]
TIM3_IRQn
= 29, /*!< TIM3 global Interrupt */
^
./CMSIS\stm32f10x.h(258): note: previous declaration is here
TIM3_IRQn = 29, /*!< TIM3 global Interrupt */
^
./CMSIS\stm32f10x.h(312): error:
redefinition of enumerator 'TIM3_IRQn'
TIM3_IRQn = 29, /*!< TIM3 global Interrupt
*/
^
./CMSIS\stm32f10x.h(258): note: previous definition is here
TIM3_IRQn = 29, /*!< TIM3 global Interrupt
*/
^
./CMSIS\stm32f10x.h(313): warning: declaration shadows a variable in the global scope [-Wshadow]
TIM4_IRQn = 30, /*!< TIM4 global Interrupt */
^
./CMSIS\stm32f10x.h(259): note:
previous declaration is here
TIM4_IRQn = 30, /*!< TIM4 global Interrupt */
^
./CMSIS\stm32f10x.h(313): error: redefinition of enumerator 'TIM4_IRQn'
TIM4_IRQn = 30, /*!< TIM4 global
Interrupt */
^
./CMSIS\stm32f10x.h(259): note: previous definition is here
TIM4_IRQn
= 30, /*!< TIM4 global Interrupt */
^
./CMSIS\stm32f10x.h(314): warning: declaration shadows a
variable in the global scope [-Wshadow]
I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt
*/
^
./CMSIS\stm32f10x.h(260): note: previous declaration is here
I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt
*/
^
./CMSIS\stm32f10x.h(314): error: redefinition of enumerator 'I2C1_EV_IRQn'
I2C1_EV_IRQn
= 31, /*!< I2C1 Event Interrupt */
^
./CMSIS\stm32f10x.h(260): note: previous definition is
here
I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
^
./CMSIS\stm32f10x.h(315):
warning: declaration shadows a variable in the global scope [-Wshadow]
I2C1_ER_IRQn = 32, /*!< I2C1 Error
Interrupt */
^
./CMSIS\stm32f10x.h(261): note: previous declaration is here
I2C1_ER_IRQn
= 32, /*!< I2C1 Error Interrupt */
^
./CMSIS\stm32f10x.h(315): error: redefinition of enumerator
'I2C1_ER_IRQn'
I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
^
./CMSIS
\stm32f10x.h(261): note: previous definition is here
I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt
*/
^
./CMSIS\stm32f10x.h(316): warning: declaration shadows a variable in the global scope [-Wshadow]
I2C2_EV_IRQn
= 33, /*!< I2C2 Event Interrupt */
^
./CMSIS\stm32f10x.h(262): note: previous
declaration is here
I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
^
./CMSIS
\stm32f10x.h(316): error: redefinition of enumerator 'I2C2_EV_IRQn'
I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt
*/
^
./CMSIS\stm32f10x.h(262): note: previous definition is here
I2C2_EV_IRQn = 33,
/*!< I2C2 Event Interrupt */
^
./CMSIS\stm32f10x.h(317): warning: declaration shadows a variable in
the global scope [-Wshadow]
I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
^
./CMSIS\stm32f10x.h(263): note: previous declaration is here
I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt
*/
^
./CMSIS\stm32f10x.h(317): error: redefinition of enumerator 'I2C2_ER_IRQn'
I2C2_ER_IRQn =
34, /*!< I2C2 Error Interrupt */
^
./CMSIS\stm32f10x.h(263): note: previous definition is here
I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
^
./CMSIS\stm32f10x.h(318):
warning: declaration shadows a variable in the global scope [-Wshadow]
SPI1_IRQn = 35, /*!< SPI1 global
Interrupt */
^
./CMSIS\stm32f10x.h(264): note: previous declaration is here
SPI1_IRQn
= 35, /*!< SPI1 global Interrupt */
^
./CMSIS\stm32f10x.h(318): error: redefinition of enumerator
'SPI1_IRQn'
SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
^
./CMSIS\stm32f10x.h
(264): note: previous definition is here
SPI1_IRQn = 35, /*!< SPI1 global Interrupt
*/
^
./CMSIS\stm32f10x.h(319): warning: declaration shadows a variable in the global scope [-Wshadow]
SPI2_IRQn
= 36, /*!< SPI2 global Interrupt */
^
./CMSIS\stm32f10x.h(265): note: previous declaration is here
SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
19 warnings and 20 errors generated.
"USER/main.c" - 19 Error(s), 19
Warning(s).
出现以上批量错误原因是:出现重复定义导致,把魔术棒的选项卡里的define选项里的STM32_F10X_HD去掉,问题解决
../Libraries/CMSIS/core_cm3.h(1720): warning: function 'NVIC_SystemReset' could be declared with attribute 'noreturn' [-Wmissing-
noreturn]
遇到这种情况,直接将只需要在keil设置里把版本ARM Compiler这一项从keil_6变成keil_5就可以了
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'd:\Keil_v5\ARM\ARMCC\Bin'
compiling main.c...
USER\main.h(8): warning: #1-D:
last line of file ends without a newline
#endif
USER\main.c: 1 warning, 0 errors
"USER\main.c" - 0 Error(s), 1 Warning(s).
原因是在头文件中的最后一行回车就行