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

akotowski
Posts: 16
Joined: Sat Sep 01, 2018 2:54 pm

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

Postby akotowski » Sat Jun 04, 2022 11:26 pm

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?

akotowski
Posts: 16
Joined: Sat Sep 01, 2018 2:54 pm

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

Postby akotowski » Sun Jun 05, 2022 11:11 pm

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")

akotowski
Posts: 16
Joined: Sat Sep 01, 2018 2:54 pm

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

Postby akotowski » Thu Jun 09, 2022 6:20 pm

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

Who is online

Users browsing this forum: No registered users and 278 guests