Skip to main content
rcard
Associate II
May 20, 2020
Solved

CubeIDE cannot find header files after import

This is an issue i currently have with two differents project. After importing an error free project, the IDE have issue linking included files.

When building i have "fatal error: FLASH_G0.h: No such file or directory" on the #include "foo.h" line, as if the .h weren't there.

But the file are there, and when i press F3 over the foo.h, the IDE open foo.h without any issue, proving the files are there and the IDE know where they are.

But i still have the error when building.

I tried the following things:

-refresh the project

-rebuild index & freshen all files

-remove the .h, refresh, put back the .h, refresh

-remove & import again the project.

Nothing fixed it and i'm running out of idea to try fixing the issue.

This topic has been closed for replies.
TDK
TDKBest answer
May 20, 2020

Ensure the directory of the header file is listed in your include paths for the compiler.

right click project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU GCC Compiler -> Include paths

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

8 replies

TDK
TDKBest answer
May 20, 2020

Ensure the directory of the header file is listed in your include paths for the compiler.

right click project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU GCC Compiler -> Include paths

"If you feel a post has answered your question, please click ""Accept as Solution""."
rcard
rcardAuthor
Associate II
May 22, 2020

That was my issue... I feel stupid.

Thanks you for your answer!

HNguy.25
Associate III
September 2, 2022

Sorry to bring this thread up again. If I want to add new header file to one of the Include paths, how can I update that path to display the new added header files?

Right now, I added new header files in Core/Inc (not shown in Project Explorer) but when I expand Core/Inc, the new added header files are not there.

TDK
September 2, 2022
Should be a refresh option. F5 or right click refresh or something.
"If you feel a post has answered your question, please click ""Accept as Solution""."
HNguy.25
Associate III
September 2, 2022

Hello, thank you for your response. I did that already but nothing was updated. This was one of the thing I did: Via File Explorer at the Core/Inc, I created a file called testing.h. Then, although I refreshed the Project Explorer tab many times, there was no testing.h in the red area.

0693W00000SuPkNQAV.png

AMabi.1
Associate II
April 24, 2023

Hi, I'm having a similar problem. When compiling, I have errors saying that header files do not exist. The project is a simple PWM on a LED. The include paths are configured. I cleaned the project, workspace, etc and restarted everything but the errors are still there. Any idea on how to solve this problem?

Example:

.../Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_core.c:22:10: fatal error: usbh_core.h: No such file or directory
 22 | #include "usbh_core.h"
 | ^~~~~~~~~~~~~

usbh_core.h is in /Middlewares/ST/STM32_USB_Host_Library/Core/Inc which is a configured path (see screenshot)


_legacyfs_online_stmicro_images_0693W00000bihTCQAY.png 

P-S: F3 does work so the IDE recognises the files.