How do I fix a “No such file or directory” build error?
Use this page with AI
Explore with your favorite AI
Gemini & other AI
Copy this page’s context into your AI to explore how it works and what you can build.
Copy the prompt, then paste it into Gemini’s message box.
View prompt
On this page
Compare the filename in the error with the library specified by your sample. The required library may be missing, or a different implementation may be installed.
- Arduino IDE: Check the name and author in Library Manager. For ZIP releases, use Sketch → Include Library → Add .ZIP Library.
- PlatformIO: Check
lib_depsin the active[env:...]section. Settings in another environment do not apply to that build.
For example, the AI04 samples use ST7032.h from tomozh’s arduino_ST7032. LCD_ST7032 and ST7032_asukiaaa are different libraries. Match the source rather than relying on a similar name.
Libraries and board definitions lists common sources and installation steps. If the build still fails after installation, start with the first error in the log and use these checks.
| Message or situation | What to check next |
|---|---|
The same header still produces No such file or directory | Check that the full library is installed and match its name, author, and header filename. For manual Arduino IDE installation, follow the official instructions: place the library in the sketchbook’s libraries folder and restart the IDE. |
| A different header is missing | Check the sample or library README for required dependencies and install them. |
| PlatformIO is building a different environment | Match the active environment name to the [env:...] section containing lib_deps. |
| The header is found, but a Core compatibility error appears | This is a different cause from a missing header. For STM32, check Core and RTC library compatibility. |
