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下载地址

相关推荐

  1. Nordic ncs安装编译问题记录

    2024-05-26 02:14:53       9 阅读
  2. 解决使用ip来访问MySQL问题

    2024-05-26 02:14:53       39 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-05-26 02:14:53       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-05-26 02:14:53       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-05-26 02:14:53       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-05-26 02:14:53       20 阅读

热门阅读

  1. Django搭建和数据迁移

    2024-05-26 02:14:53       10 阅读
  2. 【Redis精通之路】数据类型(2)

    2024-05-26 02:14:53       10 阅读
  3. 删除有序数组中的重复项-力扣

    2024-05-26 02:14:53       10 阅读
  4. springboot项目跨域设置总结

    2024-05-26 02:14:53       11 阅读
  5. Flink 任务调度策略:Eager 模式详解

    2024-05-26 02:14:53       9 阅读
  6. Flink 任务调度策略:Lazy from Sources 深入解析

    2024-05-26 02:14:53       11 阅读
  7. 海外投放面试手册

    2024-05-26 02:14:53       12 阅读