Skip to main content
Associate
Mar 2, 2026 8:46 AM UTC
Solved

Can't include custom source file

Hi,

I wrote my own source file. It is located in the Core/Src directory. I have also entered it accordingly in cmakelists.txt.

my cmakelists.txtmy cmakelists.txt

Now I get an error saying that the include files from the Drivers directory are missing.

Bildschirmfoto vom 2026-03-02 09-45-19.png

If I remove my entry, I no longer get the error. But then I can't use my customs. Is there a sample cmakelists.txt that includes customs?

Thank you,

Funnypinky

TDK
TDKBest answer
Mar 2, 2026 12:16 PM UTC

If it's like other families, you should only include the top-level "stm32wlxx_hal.h", and not individual HAL files.

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

5 replies

Nawres GHARBI
ST Technical Moderator
Mar 2, 2026 10:09 AM UTC

hi @Funnypinky 

for me seems an include issue, how did you manage the includes in your custom file please ? 

Associate
Mar 2, 2026 10:13 AM UTC

Hi @Nawres GHARBI ,

i include the 

    stm32wlxx_hal_def.h
 
think you i must include the another files?
TDK
TDKBest answer
Mar 2, 2026 12:16 PM UTC

If it's like other families, you should only include the top-level "stm32wlxx_hal.h", and not individual HAL files.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Associate
Mar 2, 2026 12:28 PM UTC

Thank you, was a little mistake, but a big search.

t_j_l
Associate II
Mar 5, 2026 6:26 AM UTC

You should modify it to Core/Src/ina226/ina226.c