1

What I am trying to do

I have an ESP32-CAM, and I want to use Visual Studio Code, I already used the Arduino IDE at first, and it worked fine.

To work with the ESP32 on VS Code I installed the extension from espressif, it seems to "work".

I created a new project arduino-as-component which give me a main.cpp like this

#include "Arduino.h"

extern "C" void app_main()
{
    initArduino();
    pinMode(4, OUTPUT);
    digitalWrite(4, HIGH);
    // Do your own thing
}

My problem

When I build the project that a newly created, without changing a thing, I get an error

../main/main.cpp:1:10: fatal error: Arduino.h: No such file or directory        
 #include "Arduino.h"

Things I tried

I downloaded the library from the Espressif Github, and imported it inside the file main/CMakeLists.txt

idf_component_register(
    SRCS "main.cpp"
    INCLUDE_DIRS "./libraries/arduino/cores/esp32"
)

But then I get a new error

../main/libraries/arduino/cores/esp32/Arduino.h:28:10: fatal error: avr/pgmspace.h: No such file or directory
 #include <avr/pgmspace.h>

I feel like I could have endless errors like this, and that it's not the right way to import a library.

I also tried to use a code that worked on the aduino IDE, but I get similar errors.

1
  • Have you installed platformio? Then #include <arduino.h> should work just fine, if you have specified "framework = arduino" in platformio.ini
    – jayben
    Apr 24, 2022 at 8:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.