Page 1 of 1

Using Arduino as an IDF component: fatal error: Arduino.h: No such file or directory

Posted: Sat Jun 04, 2022 11:26 pm
by akotowski
I created a project using Arduino as an IDF component. The test program works.
I then added my own library function. The library function uses Arduino and therefore has a "# include Arduino.h" statement.
For the library function I get "fatal error: Arduino.h: No such file or directory."

The directory structure is:
-AKArduinoTest/
---CMakeLists.txt
---main/
-----main.cpp
-----CMakeLists.txt
---esp_idf_components/
---components/
-----arduino/
-----Temp18x20/
--------include/
-----------Temp18x20.h
--------Temp18x20.cpp
--------CMakeLists.txt

Any suggestions?

Re: Using Arduino as an IDF component: fatal error: Arduino.h: No such file or directory

Posted: Sun Jun 05, 2022 11:11 pm
by akotowski
I believe I need a CMakeLists.txt entry so that Temp18x20 will access the Arduino library just like main.cpp.
Adding the 3rd line below starts compilation but error are thrown when other portions of the Arduino Library are not found.
The CMakeLists.txt file in Temp18x20:

Code: Select all

idf_component_register(SRCS "Temp18x20.cpp"
                    INCLUDE_DIRS "include"
                    PRIV_INCLUDE_DIRS "../arduino/cores/esp32")

Re: Using Arduino as an IDF component: fatal error: Arduino.h: No such file or directory

Posted: Thu Jun 09, 2022 6:20 pm
by akotowski
Here is the CMakeLists.txt file for the Temp18x20 directory:

Code: Select all

idf_component_register(SRCS "Temp18x20.cpp"
                    INCLUDE_DIRS "include"
                    REQUIRES arduino OneWire)
And then you have to add the OneWIre library and it's CMakeLists.txt files