KEIL编译STM32官方库报错error: #5: cannot open source input file "core_cm0.h": No such file or directory

从官方下载的外设库,编译时报错:

..\..\..\Libraries\CMSIS\Device\ST\STM32F0xx\Include\stm32f0xx.h(479): error:  #5: cannot open source input file "core_cm0.h": No such file or directory

KEIL编译STM32官方库报错error: #5: cannot open source input file

原因:所使用的MDK版本太新了,比如我用的是MDK5.25.3.0,它们不会从MDK安装目录去查找头文件。 所以导致这个错误。

解决办法:

方法1:

core_cm0.h这个头文件一般在官方库目录 STM32F0xx standard peripherals library\STM32F0xx_StdPeriph_Lib_V1.5.0\Libraries\CMSIS\Include文件夹里面,在Options for target-C/C++-include path里面加入这个文件夹即可。

KEIL编译STM32官方库报错error: #5: cannot open source input file

方法2:

将官方库目录 STM32F0xx standard peripherals library\STM32F0xx_StdPeriph_Lib_V1.5.0\Libraries\CMSIS\Include文件夹里面的文件复制到keil软件安装的include目录下

C:\Keil_v5\ARM\Pack\Keil\STM32F0xx_DFP\1.2.0\Device\Include

KEIL编译STM32官方库报错error: #5: cannot open source input file

你可能感兴趣的:(Keil)