Issue compiling a project in VSCode: can't find main.h
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-28 11:40 PM - last edited on 2025-02-12 1:29 AM by Andrew Neil
Hi everyone,
I’m still having an issue with my STM32F746G-Discovery board. I want to run the program using VSCode, but I’m encountering errors in my main.c file. Specifically, it can't find main.h, and as a result, the code isn’t running.
I want to build and run the code directly in VSCode, but it’s not working as expected. Could it be that the compiler is misconfigured? I’m currently using the GCC compiler for C/C++.
I also switched the toolchain in CubeMX to Makefile. After that, I installed CubeCLT and tried to run and build the code, but nothing happened.
- Labels:
-
VSCode for STM32
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-29 12:01 AM
Well, the instructions (from your last topic or STM32 VS Code Extension - Visual Studio Marketplace) work well for me, and many many others. So it must be something specific to your system.
generic help:
- reinstall from scratch, try on a different system
- in the beginning, avoid exotic systems like some Linuxes and virtual machines
- stick to short & simple path for your project and toolchain: only use ASCII chars in the path, no ümlauts, spaces, special or exotic chars
- re-read and follow the instructions
- find a local expert for a second opinion
- try Rubber duck debugging - Wikipedia
hth
KnarfB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-02-12 1:04 AM
This post is related to this conversation: Solved: Main.h is not found - STMicroelectronics Community
Normally VS Code gives you the quick fix method by adding ${workspaceFolder}/Drivers/CMSIS/Device/ST/STM32F1xx/Include to includePath parameter.
>>I also switched the toolchain in CubeMX to Makefile
Try following this article: How to use VS Code with STM32 microcontrollers - STMicroelectronics Community
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-02-12 1:27 AM - edited 2025-02-12 2:08 AM
@Bea_12 wrote:Specifically, it can't find main.h,
As stated in your previous thread, if it's not finding the headers, that means your Include Paths need fixing - these are what tell the compiler where to find header files.
So it seems you still haven't fixed that problem?
PS:
You haven't said what Host platform you're running on - Windows? Linux? other?
If Linux, remember that it's case-sensitive...
PPS:
Another common cause of difficulties is spaces and/or "special" characters in folder names...
PPPS:
An article on VSCode Include Paths:
https://labs.dese.iisc.ac.in/embeddedlab/vscode-include-paths/
A complex system designed from scratch never works and cannot be patched up to make it work.
