The error means the compiler cannot find the header the sketch includes. Install the library that provides it.
What the message means
Each #include names a file inside a library. If the library is not installed, or is in the wrong folder, the compile stops.
Fix it in this order
- Open Sketch > Include Library > Manage Libraries and search for the library name.
- Install the library by the expected author. Several libraries share similar names.
- For a ZIP use Sketch > Include Library > Add .ZIP Library.
- Check the library folder name matches, and has no extra nested folder inside.
- Restart the IDE after installing.
- Check the library supports your board. Some are made for AVR boards only.
Why it happens
An #include line names a header file. The compiler searches the sketch folder, the libraries folder, and the core libraries for that file. A library provides the header, and it must sit in one of those folders with its folder name and files intact. When the library is absent or its folder is nested wrongly, the search fails and the build stops at the include line.
Many libraries share similar names, and some are written for only one board family, such as AVR. Board packages can also change which libraries are bundled. A library that compiles for an Uno may not compile for an ESP32 because it uses hardware registers that only exist on AVR. Checking the architectures field in the library’s library.properties file helps confirm it fits your board.
If you see this, do this
| You see | Do this |
|---|---|
| Header still not found | Wrong library or wrong folder. |
| Compiles on one board, not another | Library supports a different architecture. |
Confirm the fix
- Open Sketch, Include Library, and check that the library name appears in the list after installing it.
- Use File, Preferences to find the sketchbook folder, then check that the library’s folder sits directly inside libraries with its .h file visible.
- Compile a blank sketch that only includes the header and calls nothing; a clean build confirms the library is found.
Common mistake: Many readers assume a library installed for one Arduino board works on every board, when the library may depend on hardware that exists on only one family.
Related
No such file or directory, ESP32 board not listed.
Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.
Why this happens
The line #include <Name.h> asks the preprocessor to look for a file called Name.h in a list of folders: the sketch folder, the board’s own libraries, and each folder under the sketchbook’s libraries directory. In a library, the header sits in a src folder, or in the top folder of an older-style library. If the preprocessor finds no match, you get ‘fatal error: Name.h: No such file or directory’.
The header name is not always the library name. The header DHT.h comes from a library called DHT sensor library, for example. And one library may include headers from another, so the missing file named in the error can belong to a dependency that you never included yourself.
How to confirm the cause
- Read the exact file name in the error. That is the header, so search the Library Manager for the library that provides it.
- Open the libraries folder inside your sketchbook folder and check that the library folder exists there with a src folder or header inside.
- Look for a doubled folder, such as libraries/Name/Name/src. The extra level hides the files.
- Check the library.properties file for the architectures line. If your board is not listed, the library may not be meant for it.
- Look at whether the error occurs in your own sketch or inside another library’s file, which tells you whether the missing item is a dependency.
Worked example
Suppose compiling a sketch that uses a temperature sensor library gives this error, and you traced it as shown in the comments.
fatal error: Adafruit_Sensor.h: No such file or directory
// 1. The name is a header, not a library name.
// 2. Search the Library Manager for "Adafruit Unified Sensor".
// 3. Install it, accept any dependency prompts, and compile again.
// 4. Check that sketchbook/libraries/ has a folder for it.The same method applies to any missing header: identify the file, find which library provides it, install it, and recompile. If the Library Manager lacks it, add it from a ZIP.
Common mistakes
- Installing a library with a similar name from a different author.
- Unzipping a library into the wrong folder, such as the IDE’s program folder.
- Ignoring the dependency prompt shown during installation.
- Not restarting the IDE after a manual copy.
If this did not fix it
- Two versions of the same library: remove the older copy.
- Case mismatch in the header name on case-sensitive systems.
- Library built for a different board family: look for an alternative made for yours.