解决 KEIL514 编译错误 \SYSTEM\sys\stm32f10x.h(478): error: #5: cannot open source input file "core_cm3.h"

本文详细介绍了在使用KEIL5编译stm32f10x.h文件时遇到的错误:找不到core_cm3.h文件,并提供了具体的解决方案。错误原因是编译器未关联正确的路径,解决办法是手动添加路径映射。

安装好KEIL5, 编译第一个文件出现一个错误:


compiling main.c…
User\stm32f10x.h(478): error: #5: cannot open source input file “core_cm3.h”: No such file or directory
#include “core_cm3.h”
User\main.c: 0 warnings, 1 error
“User\main.c” - 1 Error(s), 0 Warning(s).

搜索KEIL_v5目录, 发觉core_cm3.h在 c:\Keil_v5\ARM\Pack\ARM\CMSIS\4.2.0\CMSIS\Include 目录下。

原因:
该core_cm3.h文件在stm32f4xx.h里面被引用,实际上是ARM CMSIS的东西,路径在MDK安装路径下,为: MDK安装目录keil_v5\ARM\Pack\ARM\CMSIS\4.2.0\CMSIS\Include

貌似程序没关联这个路径。

那我们可以通过手动制定路径的办法,解决这个问题.

解决方法:
添加路径映射:点击魔术棒–>C/C++选项卡–>Include Paths ,添加
C:\Keil_v5\ARM\Pack\ARM\CMSIS\4.2.0\CMSIS\Include

再编译, 顺利通过。

在这里插入图片描述

Build started: Project: BC26-Smoker *** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\迅雷下载\keil ruanj\ARM\ARMCC\Bin' Build target 'Target 1' compiling stm32f1xx_hal_gpio_ex.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal_gpio_ex.c: 0 warnings, 1 error compiling stm32f1xx_hal_adc.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal_adc.c: 0 warnings, 1 error compiling stm32f1xx_hal_rcc_ex.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal_rcc_ex.c: 0 warnings, 1 error compiling stm32f1xx_hal_cortex.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal_cortex.c: 0 warnings, 1 error compiling stm32f1xx_hal_flash.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal_flash.c: 0 warnings, 1 error compiling stm32f1xx_hal_tim.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal_tim.c: 0 warnings, 1 error compiling stm32f1xx_hal_dma.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal_dma.c: 0 warnings, 1 error compiling stm32f1xx_hal_flash_ex.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal_flash_ex.c: 0 warnings, 1 error compiling stm32f1xx_hal_exti.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal_exti.c: 0 warnings, 1 error compiling stm32f1xx_hal.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal.c: 0 warnings, 1 error compiling stm32f1xx_hal_gpio.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal_gpio.c: 0 warnings, 1 error compiling stm32f1xx_hal_pwr.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal_pwr.c: 0 warnings, 1 error compiling stm32f1xx_hal_adc_ex.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal_adc_ex.c: 0 warnings, 1 error compiling stm32f1xx_hal_rcc.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal_rcc.c: 0 warnings, 1 error compiling misc.c... compiling stm32f1xx_hal_tim_ex.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal_tim_ex.c: 0 warnings, 1 error compiling stm32f1xx_hal_uart.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\libarary\src\stm32f1xx_hal_uart.c: 0 warnings, 1 error compiling stm32f10x_bkp.c... compiling stm32f10x_adc.c... compiling stm32f10x_cec.c... compiling stm32f10x_crc.c... compiling stm32f10x_can.c... compiling stm32f10x_dac.c... compiling stm32f10x_dbgmcu.c... compiling stm32f10x_dma.c... compiling stm32f10x_exti.c... compiling stm32f10x_flash.c... compiling stm32f10x_fsmc.c... compiling stm32f10x_gpio.c... compiling stm32f10x_i2c.c... compiling stm32f10x_iwdg.c... compiling stm32f10x_pwr.c... compiling stm32f10x_rtc.c... compiling stm32f10x_rcc.c... compiling stm32f10x_sdio.c... compiling stm32f10x_spi.c... compiling gpio.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\system\gpio\gpio.c: 0 warnings, 1 error compiling system.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\system\sys\system.c: 0 warnings, 1 error compiling stm32f10x_usart.c... compiling stm32f10x_wwdg.c... compiling tim.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\system\timer\tim.c: 0 warnings, 1 error compiling stm32f10x_tim.c... compiling usart.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ..\system\usart\usart.c: 0 warnings, 1 error compiling delay1.c... compiling sys.c... compiling timer.c... ..\system\timer\timer.c(2): error: #5: cannot open source input file "led.h": No such file or directory #include "led.h" ..\system\timer\timer.c: 0 warnings, 1 error compiling adc.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" adc\adc.c: 0 warnings, 1 error compiling BC26.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" bc26\BC26.c: 0 warnings, 1 error compiling ds18b20.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" ds18b20\ds18b20.c: 0 warnings, 1 error compiling lcd1602.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" lcd1602\lcd1602.c: 0 warnings, 1 error compiling usart1.c... ..\system\usart\usart1.c(20): warning: #260-D: explicit type is missing ("int" assumed) _sys_exit(int x) ..\system\usart\usart1.c: 1 warning, 0 errors compiling system_stm32f10x.c... compiling main.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" main.c: 0 warnings, 1 error compiling wdg.c... compiling adc1.c... compiling stm32f10x_it.c... compiling core_cm3.c... compiling main1.c... ..\libarary\inc\stm32f1xx_hal_def.h(29): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory #include "stm32f1xx.h" main1.c: 0 warnings, 1 error ".\Objects\BC26-Smoker.axf" - 27 Error(s), 1 Warning(s). Target not created. Build Time Elapsed: 00:00:02
09-05
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值