Compilation error: ESP32 cam giving this error: 'CAMERA_FB_IN_PSRAM' was not declared in this scope

Hi. So i am trying to run an object detection model on the esp32 cam and i have downloaded the arduino library from the edge impulse studio. After compiling it, i am getting this error:

/private/var/folders/9p/hp8d4cf11951m6wjg5pn4mpr0000gn/T/.arduinoIDE-unsaved2023229-89059-n6viv0.fhv09/esp32_camera/esp32_camera.ino:116:20: error: ‘CAMERA_FB_IN_PSRAM’ was not declared in this scope
.fb_location = CAMERA_FB_IN_PSRAM,
/private/var/folders/9p/hp8d4cf11951m6wjg5pn4mpr0000gn/T/.arduinoIDE-unsaved2023229-89059-n6viv0.fhv09/esp32_camera/esp32_camera.ino:117:18: error: ‘CAMERA_GRAB_WHEN_EMPTY’ was not declared in this scope
/private/var/folders/9p/hp8d4cf11951m6wjg5pn4mpr0000gn/T/.arduinoIDE-unsaved2023229-89059-n6viv0.fhv09/esp32_camera/esp32_camera.ino:118:1: error: ‘camera_config_t’ has no non-static data member named ‘fb_location’

exit status 1

Compilation error: ‘CAMERA_FB_IN_PSRAM’ was not declared in this scope

UPDATE: Ok so i updated the esp32 library and its compiling now but a new error has come up:
(serial monitor)
ERR: Camera is not initialized
Failed to capture image

1 Like

Hi @zappy383

The cable for the camera may need to be removed and reconnected. (From the last error you shared)

Which model of the esp32 cam are you using and what guide are you following? Thanks!


Hi Jorduino! Thanks for the response but I have solved the error. I just had to press the reset button on the esp32 cam again. Once I did it, The detections began.

1 Like

Hi @zappy383 I have the same problem that you have from the beginning, what did you do to make it compile? And in the event that the esp library updates it, what version did you put it on?

Yes @jorduino can you please suggest something to solve " ‘CAMERA_FB_IN_PSRAM’ was not declared in this scope " error ?

Hello @d_square018,

Can you check if the PSRAM is enabled when you select the ESP32 Dev Module?



Thank you @louis that error is resolved now it is showing “Camera is not initialized” in serial monitor, what to do ?

Hello, how can I solve the ‘CAMERA_FB_IN_PSRAM’ was not declared in this scope error? I have all libraries updated.

Well, “update” is not exactly necessary. Rather it should be the correct version. We wrote Arduino sketches for 2.0.4 ESP32 Arduino Core (corresponding to ESP-IDF 4.4) and I also used it with 2.0.5. Can you try 2.0.5 and see that resolves the compilation error?

Is that why the arduino sketches don’t work on Arduino IDE 2.1.1?

I’m not referring to the Arduino IDE version - I’m referring to ESP32 Arduino core version.

@AIWintermuteAI When you say core do you mean to select 2.0.4 or 2.0.5 from this dropdown?


Yes, exactly that core. I wrote the sketches with 2.0.4 and used them with 2.0.5. This is also what we use in our CI. Everything above that is untested.
A more direct answer: you can use either 2.0.4 or 2.0.5.

1 Like

@louis i have the " ‘CAMERA_FB_IN_PSRAM’ was not declared in this scope " error ?

i ran as Dev Module didnt work, Ran as AI Thinker, ran as wrover module too same thing

As stated above:

  • Are you using the various versions? If so what versions are you using?
  • Is the PSRAM enabled?

@Octopaws again, this is likely related to Arduino ESP32 core version. Use 2.0.4 core.

Bonjour/bonsoir a tous j’suis un étudiant de niveau 3 je boss sur un projet portant sur la détection d’objet. Alors j’ai fait un essai pour la reconnaissance d’une forme carré avec edge impulse et par la suite jai pu paisiblement récupéré la bibliothèque lié a cette forme pour arduino .lorsque j’essaie de la compiler je recois le message d’erreur :"erreur de compilation pour la carte Ai thinker " s’il vous plaît besoin d’aide je suis exténuée
Merci merci :grin:

  1. Vérifiez votre configuration de projet : Assurez-vous que votre projet est correctement configuré pour la carte Ai Thinker dans l’IDE Arduino.

Tools>boards> Ai Thinker??

  1. Vérifiez les dépendances : Assurez-vous que toutes les bibliothèques requises par votre projet sont correctement installées et à jour.