cancel
Showing results for 
Search instead for 
Did you mean: 

Main.h is not found

Bea_12
Associate

Hi,

I generated the code in CubeMX and opened it in VSCode. However, I cannot run the code because VSCode cannot find main.h. I'm not sure why this is happening. I've generated the code twice, but the problem persists. The main.h file is located in the Core > Inc folder, and main.c is in the Core > Src folder. Does anyone know what might be causing this issue? Thanks!

Bea_12_0-1737980665497.png

 

1 ACCEPTED SOLUTION
10 REPLIES 10
KnarfB
Principal III

Did you import the project and open the folder? Here are instructions:

How to use VS Code with STM32 microcontrollers - STMicroelectronics Community

hth

KnarfB

Yes, I followed the instructions, but I have the feeling that something might be off with the settings or something else. Is there something I might need to adjust?

Thank you, I'll try it. I hope it works ;) 

It still doesn’t work. I’ve checked it with two colleagues, and everything seems fine on our end. So, we believe the issue might be with the compiler.

Does VSCode show you the command lines as it executes them during a build?

Or does it record that in a log file somewhere?

 

PS:

You haven't said what platform you're on.

If linux, remember that it is case-sensitive ...

"VSCode doesn't show the command line. I also tried it in Visual Studio, but unfortunately, I can't run my program because the file main.h can't be found. There are no errors; it just won't build."
i am useing windows right now 
Karl Yamashita
Lead III

upload your ioc file

Don't worry, I won't byte.
TimerCallback tutorial! | UART and DMA Idle tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.
Bea_12
Associate

It seems like I've resolved one of the issues by changing some settings in STM32CubeMX. However, the main.c and main.h files are still incorrect. No matter what I change, the files remain problematic. Additionally, I forgot to install STM32CubeCLT, but that hasn’t affected anything else so far. I do not know what i could change that my program works. Does anyone know please explain it to me.