Fix “esp_camera.h: No such file or directory”
The selected board has no camera driver. Choose an ESP32 board like “AI Thinker ESP32-CAM” with the esp32 core installed — not Uno, ESP8266 or ESP32-C3.
Community draft — report a mistake
What you see
CameraWebServer.ino:1:10: fatal error: esp_camera.h: No such file or directory
#include "esp_camera.h"
^~~~~~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: esp_camera.h: No such file or directoryCameraWebServer.ino:1:10: fatal error: esp_camera.h: No such file or directory
#include "esp_camera.h"
^~~~~~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: esp_camera.h: No such file or directory
esp_camera.h is part of the Espressif camera driver, which the esp32 core bundles for chips that have a camera interface. If the selected board is anything else, the compiler looks for the file and finds nothing.
Fix the board selection, not the code — the CameraWebServer example compiles unchanged once AI Thinker ESP32-CAM is selected.
Quick fix — try in order
- 1
Select the camera board
Tools → Board → esp32 → AI Thinker ESP32-CAM (or ESP32S3 Dev Module for S3 camera boards). The header ships inside the esp32 core, not as a library.
- 2
Install the esp32 core if it’s missing
Boards Manager → search “esp32” → install esp32 by Espressif Systems. Add
https://espressif.github.io/arduino-esp32/package_esp32_index.jsonto Additional Boards Manager URLs first. - 3
Don’t install a random esp_camera library
Copies of esp_camera.h from GitHub don’t match your core and cause hundreds of new errors. The core already has the right one.
- 4
Check the chip supports a camera
Only the ESP32 and ESP32-S3 have the camera interface. ESP32-C3, C6, S2 and ESP8266 cannot use esp_camera.
Why it happens
It compiled yesterday
The board selection changed — Arduino IDE switches boards when you open a sketch that was last used with another board, or when you pick a port.
Arduino Uno selected
AVR boards have nothing named esp_camera. Every ESP32 header fails the same way, e.g. WiFi.h picks up a different library or fails too.
PlatformIO
Use platform = espressif32, board = esp32cam, framework = arduino.
Board-specific notes
ESP32-CAM: Once it compiles, see Camera init failed and the ESP32-CAM board page for wiring and upload.
ESP32-C3: No camera peripheral. Choose an ESP32-CAM or an S3 board with a camera connector.
Did this fix it?
Thanks — that helps us keep this page right.