Arm Mbed OS support forum

"mbed.h" not found because of BUILD folder

I just noticed that the contents of the “BUILD” folder affected the link between the “main.cpp” program and the mbed library:
I imported a program from the Mbed online compiler to Mbed Studio (This program was originally linked to Mbed 2, I migrated it to Mbed-OS 6.12.0 before importing it).
I managed to get it to work, then I wanted to implement the bar-metal profile by adding a “mbed_app.json” file. With this file the line #include “mbed.h” was underlined in red so impossible to make it work again. :unamused:
I first succeeded by creating another program from “mbed-os-example-blinky-baremetal” then replacing the main.cpp and adding the specific libraries. :slightly_smiling_face:
I then ended up with two almost identical programs one working and the other not, the files were identical except for the contents of the BUILD folders. :thinking:
By deleting the BUILD folder both programs work. :grinning:
I innocently believed that the BUILD folder only affected the compilation result. I thought this particularly vicious malfunction (solving is easy when you know), which is why I shared it here. :wink:
(My program comes from “cn0391-helloworld”, my target is a NUCLEO-F446RE, the version of Mbed Studio: 1.4.1)

1 Like

In my case, using Mbed CLI, BUILD folder is automatically ignored. Anyway, maybe you can use .mbedignore file to explicitly ignore it.

Thank you for your reply.
Mbed CLI Would it be more completed?

Actually, I don’t know the current state of Mbed Studio so I can’t give you an exact answer. But for us, Mbed CLI is working well for dependency management and compilation. Maybe you can make an attempt and try it! :slightly_smiling_face:

I’ll see when I have some time.
Thank you for your reply.