2026-03-25 6:34 AM
The CubeMX suddenly can't generate some .h files such as stm32f103xb.h, core_cm3.h, stm32f1xx_hal_rcc.h ..., I tried to use legacy CubeMX to generate but still the same.
How to fix it?
Left picture is what it should look like ,and the right one is the wrong one.
Solved! Go to Solution.
2026-03-26 4:32 AM
The issue has been temporarily resolved. After I changed the firmware package version to 1.8.5, I was able to compile successfully on both KEIL and CLion. Additionally, version 1.8.6 can only be compiled on KEIL MDK v6, but not on v5.
2026-03-25 6:44 AM - edited 2026-03-25 6:45 AM
It only generates what it needs. There is no issue with this. If a peripheral isn't used, it won't include those header files.
If you're having problem compiling code generated with an IOC file, include that IOC file.
2026-03-25 7:37 AM - edited 2026-03-25 7:38 AM
Hello @AL1S and welcome to the ST community,
RCC related files need at least to be generated.
What CubeMx version are you using? could you please attach your ioc file?
2026-03-25 7:40 AM
But I didn’t add anything to the generated code, and it fails to compile directly, giving an error about missing header files.
2026-03-25 7:52 AM
Does it say code was generated successfully? Sounds like your installation is corrupted.
2026-03-25 9:51 PM
I have now tried resetting the system and reinstalling the latest CubeMX, but files are still missing from the generated code, and compiling directly results in an error.
Build started: Project: test
*** Using Compiler 'V5.05 update 2 (build 169)', folder: 'D:\KEIL\ARM\ARM Compiler 5.05 update 2 (bulid 169)\Bin'
Build target 'test'
assembling startup_stm32f103xb.s...
compiling main.c...
../Core/Inc/stm32f1xx_hal_conf.h(238): error: #5: cannot open source input file "stm32f1xx_hal_rcc.h": No such file or directory
#include "stm32f1xx_hal_rcc.h"
../Core/Src/main.c: 0 warnings, 1 error
compiling stm32f1xx_hal_cortex.c...
../Core/Inc/stm32f1xx_hal_conf.h(238): error: #5: cannot open source input file "stm32f1xx_hal_rcc.h": No such file or directory
#include "stm32f1xx_hal_rcc.h"
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c: 0 warnings, 1 error
compiling gpio.c...
../Core/Inc/stm32f1xx_hal_conf.h(238): error: #5: cannot open source input file "stm32f1xx_hal_rcc.h": No such file or directory
#include "stm32f1xx_hal_rcc.h"
../Core/Src/gpio.c: 0 warnings, 1 error
compiling stm32f1xx_hal_gpio.c...
../Core/Inc/stm32f1xx_hal_conf.h(238): error: #5: cannot open source input file "stm32f1xx_hal_rcc.h": No such file or directory
#include "stm32f1xx_hal_rcc.h"
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c: 0 warnings, 1 error
compiling stm32f1xx_hal_rcc.c...
../Core/Inc/stm32f1xx_hal_conf.h(238): error: #5: cannot open source input file "stm32f1xx_hal_rcc.h": No such file or directory
#include "stm32f1xx_hal_rcc.h"
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c: 0 warnings, 1 error
compiling stm32f1xx_hal_dma.c...
../Core/Inc/stm32f1xx_hal_conf.h(238): error: #5: cannot open source input file "stm32f1xx_hal_rcc.h": No such file or directory
#include "stm32f1xx_hal_rcc.h"
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c: 0 warnings, 1 error
compiling stm32f1xx_hal_msp.c...
../Core/Inc/stm32f1xx_hal_conf.h(238): error: #5: cannot open source input file "stm32f1xx_hal_rcc.h": No such file or directory
#include "stm32f1xx_hal_rcc.h"
../Core/Src/stm32f1xx_hal_msp.c: 0 warnings, 1 error
compiling stm32f1xx_it.c...
../Core/Inc/stm32f1xx_hal_conf.h(238): error: #5: cannot open source input file "stm32f1xx_hal_rcc.h": No such file or directory
#include "stm32f1xx_hal_rcc.h"
../Core/Src/stm32f1xx_it.c: 0 warnings, 1 error
compiling stm32f1xx_hal_gpio_ex.c...
../Core/Inc/stm32f1xx_hal_conf.h(238): error: #5: cannot open source input file "stm32f1xx_hal_rcc.h": No such file or directory
#include "stm32f1xx_hal_rcc.h"
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c: 0 warnings, 1 error
compiling stm32f1xx_hal.c...
../Core/Inc/stm32f1xx_hal_conf.h(238): error: #5: cannot open source input file "stm32f1xx_hal_rcc.h": No such file or directory
#include "stm32f1xx_hal_rcc.h"
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c: 0 warnings, 1 error
compiling stm32f1xx_hal_rcc_ex.c...
../Core/Inc/stm32f1xx_hal_conf.h(238): error: #5: cannot open source input file "stm32f1xx_hal_rcc.h": No such file or directory
#include "stm32f1xx_hal_rcc.h"
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c: 0 warnings, 1 error
compiling stm32f1xx_hal_pwr.c...
../Core/Inc/stm32f1xx_hal_conf.h(238): error: #5: cannot open source input file "stm32f1xx_hal_rcc.h": No such file or directory
#include "stm32f1xx_hal_rcc.h"
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c: 0 warnings, 1 error
compiling stm32f1xx_hal_flash.c...
../Core/Inc/stm32f1xx_hal_conf.h(238): error: #5: cannot open source input file "stm32f1xx_hal_rcc.h": No such file or directory
#include "stm32f1xx_hal_rcc.h"
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c: 0 warnings, 1 error
compiling stm32f1xx_hal_flash_ex.c...
../Core/Inc/stm32f1xx_hal_conf.h(238): error: #5: cannot open source input file "stm32f1xx_hal_rcc.h": No such file or directory
#include "stm32f1xx_hal_rcc.h"
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c: 0 warnings, 1 error
compiling stm32f1xx_hal_exti.c...
../Core/Inc/stm32f1xx_hal_conf.h(238): error: #5: cannot open source input file "stm32f1xx_hal_rcc.h": No such file or directory
#include "stm32f1xx_hal_rcc.h"
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c: 0 warnings, 1 error
compiling system_stm32f1xx.c...
../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h(130): error: #5: cannot open source input file "stm32f103xb.h": No such file or directory
#include "stm32f103xb.h"
../Core/Src/system_stm32f1xx.c: 0 warnings, 1 error
"test\test.axf" - 16 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:00
2026-03-26 12:07 AM
Are you deliberately ignoring my questions?
2026-03-26 4:32 AM
The issue has been temporarily resolved. After I changed the firmware package version to 1.8.5, I was able to compile successfully on both KEIL and CLion. Additionally, version 1.8.6 can only be compiled on KEIL MDK v6, but not on v5.