Keil编译报错的问题解决

在使用keil编码STM32的时候,由于选错了编译器的版本,导致编译报了一大堆错误。错误的内容很多,摘取一部分贴出来,如下:

static __INLINE void __enable_irq()               { __ASM volatile ("cpsie i"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1204): error: expected identifier or '('
static __INLINE void __enable_irq()               { __ASM volatile ("cpsie i"); }
                ^
../System/core_cm3.h(1205): error: unknown type name 'inline'
static __INLINE void __disable_irq()              { __ASM volatile ("cpsid i"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1205): error: expected identifier or '('
static __INLINE void __disable_irq()              { __ASM volatile ("cpsid i"); }
                ^
../System/core_cm3.h(1207): error: unknown type name 'inline'
static __INLINE void __enable_fault_irq()         { __ASM volatile ("cpsie f"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1207): error: expected identifier or '('
static __INLINE void __enable_fault_irq()         { __ASM volatile ("cpsie f"); }
                ^
../System/core_cm3.h(1208): error: unknown type name 'inline'
static __INLINE void __disable_fault_irq()        { __ASM volatile ("cpsid f"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1208): error: expected identifier or '('
static __INLINE void __disable_fault_irq()        { __ASM volatile ("cpsid f"); }
                ^
../System/core_cm3.h(1210): error: unknown type name 'inline'
static __INLINE void __NOP()                      { __ASM volatile ("nop"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1210): error: expected identifier or '('
static __INLINE void __NOP()                      { __ASM volatile ("nop"); }
                ^
../System/core_cm3.h(1211): error: unknown type name 'inline'
static __INLINE void __WFI()                      { __ASM volatile ("wfi"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1211): error: expected identifier or '('
static __INLINE void __WFI()                      { __ASM volatile ("wfi"); }
                ^
../System/core_cm3.h(1212): error: unknown type name 'inline'
static __INLINE void __WFE()                      { __ASM volatile ("wfe"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1212): error: expected identifier or '('
static __INLINE void __WFE()                      { __ASM volatile ("wfe"); }
                ^
../System/core_cm3.h(1213): error: unknown type name 'inline'
static __INLINE void __SEV()                      { __ASM volatile ("sev"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1213): error: expected identifier or '('
static __INLINE void __SEV()                      { __ASM volatile ("sev"); }
                ^
../System/core_cm3.h(1214): error: unknown type name 'inline'
static __INLINE void __ISB()                      { __ASM volatile ("isb"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1214): error: expected identifier or '('
static __INLINE void __ISB()                      { __ASM volatile ("isb"); }
                ^
../System/core_cm3.h(1215): error: unknown type name 'inline'
static __INLINE void __DSB()                      { __ASM volatile ("dsb"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
compiling stm32f10x_adc.c...
warning: unknown warning option '-Wno-reserved-identifier'; did you mean '-Wno-reserved-id-macro'? [-Wunknown-warning-option]
../Library/src/stm32f10x_cec.c(23): warning: In file included from...
../Library/inc\stm32f10x_cec.h(32): warning: In file included from...
../System\stm32f10x.h(478): warning: In file included from...
../System/core_cm3.h(1204): error: unknown type name 'inline'
static __INLINE void __enable_irq()               { __ASM volatile ("cpsie i"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1204): error: expected identifier or '('
static __INLINE void __enable_irq()               { __ASM volatile ("cpsie i"); }
                ^
../System/core_cm3.h(1205): error: unknown type name 'inline'
static __INLINE void __disable_irq()              { __ASM volatile ("cpsid i"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1205): error: expected identifier or '('
static __INLINE void __disable_irq()              { __ASM volatile ("cpsid i"); }
                ^
../System/core_cm3.h(1207): error: unknown type name 'inline'
static __INLINE void __enable_fault_irq()         { __ASM volatile ("cpsie f"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1207): error: expected identifier or '('
static __INLINE void __enable_fault_irq()         { __ASM volatile ("cpsie f"); }
                ^
../System/core_cm3.h(1208): error: unknown type name 'inline'
static __INLINE void __disable_fault_irq()        { __ASM volatile ("cpsid f"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1208): error: expected identifier or '('
static __INLINE void __disable_fault_irq()        { __ASM volatile ("cpsid f"); }
                ^
../System/core_cm3.h(1210): error: unknown type name 'inline'
static __INLINE void __NOP()                      { __ASM volatile ("nop"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1210): error: expected identifier or '('
static __INLINE void __NOP()                      { __ASM volatile ("nop"); }
                ^
../System/core_cm3.h(1211): error: unknown type name 'inline'
static __INLINE void __WFI()                      { __ASM volatile ("wfi"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1211): error: expected identifier or '('
static __INLINE void __WFI()                      { __ASM volatile ("wfi"); }
                ^
../System/core_cm3.h(1212): error: unknown type name 'inline'
static __INLINE void __WFE()                      { __ASM volatile ("wfe"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1212): error: expected identifier or '('
static __INLINE void __WFE()                      { __ASM volatile ("wfe"); }
                ^
../System/core_cm3.h(1213): error: unknown type name 'inline'
static __INLINE void __SEV()                      { __ASM volatile ("sev"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1213): error: expected identifier or '('
static __INLINE void __SEV()                      { __ASM volatile ("sev"); }
                ^
../System/core_cm3.h(1214): error: unknown type name 'inline'
static __INLINE void __ISB()                      { __ASM volatile ("isb"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1214): error: expected identifier or '('
static __INLINE void __ISB()                      { __ASM volatile ("isb"); }
                ^
../System/core_cm3.h(1215): error: unknown type name 'inline'
static __INLINE void __DSB()                      { __ASM volatile ("dsb"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
compiling stm32f10x_cec.c...
warning: unknown warning option '-Wno-reserved-identifier'; did you mean '-Wno-reserved-id-macro'? [-Wunknown-warning-option]
../Library/src/stm32f10x_can.c(23): warning: In file included from...
../Library/inc\stm32f10x_can.h(32): warning: In file included from...
../System\stm32f10x.h(478): warning: In file included from...
../System/core_cm3.h(1204): error: unknown type name 'inline'
static __INLINE void __enable_irq()               { __ASM volatile ("cpsie i"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1204): error: expected identifier or '('
static __INLINE void __enable_irq()               { __ASM volatile ("cpsie i"); }
                ^
../System/core_cm3.h(1205): error: unknown type name 'inline'
static __INLINE void __disable_irq()              { __ASM volatile ("cpsid i"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1205): error: expected identifier or '('
static __INLINE void __disable_irq()              { __ASM volatile ("cpsid i"); }
                ^
../System/core_cm3.h(1207): error: unknown type name 'inline'
static __INLINE void __enable_fault_irq()         { __ASM volatile ("cpsie f"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1207): error: expected identifier or '('
static __INLINE void __enable_fault_irq()         { __ASM volatile ("cpsie f"); }
                ^
../System/core_cm3.h(1208): error: unknown type name 'inline'
static __INLINE void __disable_fault_irq()        { __ASM volatile ("cpsid f"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1208): error: expected identifier or '('
static __INLINE void __disable_fault_irq()        { __ASM volatile ("cpsid f"); }
                ^
../System/core_cm3.h(1210): error: unknown type name 'inline'
static __INLINE void __NOP()                      { __ASM volatile ("nop"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1210): error: expected identifier or '('
static __INLINE void __NOP()                      { __ASM volatile ("nop"); }
                ^
../System/core_cm3.h(1211): error: unknown type name 'inline'
static __INLINE void __WFI()                      { __ASM volatile ("wfi"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1211): error: expected identifier or '('
static __INLINE void __WFI()                      { __ASM volatile ("wfi"); }
                ^
../System/core_cm3.h(1212): error: unknown type name 'inline'
static __INLINE void __WFE()                      { __ASM volatile ("wfe"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1212): error: expected identifier or '('
static __INLINE void __WFE()                      { __ASM volatile ("wfe"); }
                ^
../System/core_cm3.h(1213): error: unknown type name 'inline'
static __INLINE void __SEV()                      { __ASM volatile ("sev"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1213): error: expected identifier or '('
static __INLINE void __SEV()                      { __ASM volatile ("sev"); }
                ^
../System/core_cm3.h(1214): error: unknown type name 'inline'
static __INLINE void __ISB()                      { __ASM volatile ("isb"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
                           ^
../System/core_cm3.h(1214): error: expected identifier or '('
static __INLINE void __ISB()                      { __ASM volatile ("isb"); }
                ^
../System/core_cm3.h(1215): error: unknown type name 'inline'
static __INLINE void __DSB()                      { __ASM volatile ("dsb"); }
       ^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */

出现这个问题,大概率是keil使用了编译器V6的版本了。

解决版本是如果没有安装V5版本,就安装一个V5版本的,如果V5和V6都安装了,那么就选择一下V5版本,重新编译就好了。

如果没有V5版本,就到官网下载一个V5版本的。我下载的是MDK526.EXE。

MDK526.EXE下载地址

  • 8
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值