cancel
Showing results for 
Search instead for 
Did you mean: 

The CubeMX didn't generated some .h files

AL1S
Associate II

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.

Snipaste_2026-03-25_21-30-36.pngSnipaste_2026-03-25_21-30-54.png

1 ACCEPTED SOLUTION

Accepted Solutions
AL1S
Associate II

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.

View solution in original post

7 REPLIES 7
TDK
Super User

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.

If you feel a post has answered your question, please click "Accept as Solution".
mƎALLEm
ST Employee

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?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
AL1S
Associate II

But I didn’t add anything to the generated code, and it fails to compile directly, giving an error about missing header files.

TDK
Super User

Does it say code was generated successfully? Sounds like your installation is corrupted.

If you feel a post has answered your question, please click "Accept as Solution".
AL1S
Associate II

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

@AL1S 

Are you deliberately ignoring my questions?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
AL1S
Associate II

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.