Build using third party component libraries

Jorgen
Posts: 51
Joined: Fri Dec 09, 2022 11:39 am

Build using third party component libraries

Postby Jorgen » Thu Jan 12, 2023 1:17 pm

Dear all,
I have used the ESP-IDF for a month and managed to get two example projects working. I use Visual Studio Code with the ESP-IDF version 5 extension. Hence no PlatformIO and no Devcontainer.

I have started trying the third party library esp-idf-lib, but I can't make it work, hence please help.

I use the "ESP-IDF: New project" command. I make use of the facility "Add your ESP-IDF Component directory" to include the esp-idf-lib in my project. I use the "template-app" when creating the project. The library is copied into the project automatically (a nice feature actually preventing me from destroying the original). The project then includes the directory: D:/Projects_Local/ESP32_IoT_book/DHT_BUZZER/components/components containing a lot of directories each being a component. For example D:/Projects_Local/ESP32_IoT_book/DHT_BUZZER/components/components/dht contains CMakeLists.txt, component.mk, dht.c, dht.h and LICENSE.
My main.c contains the statement #include <dht.h>

Question 1: When I compile and build the project I get the error message:
"Component directory D:/Projects_Local/ESP32_IoT_book/DHT_BUZZER/components/components does not contain a CMakeLists.txt file. No component will be added"
Hence, it does not look sufficiently down in the directory. My understanding reading the documentation on the Build is that it automatically goes down to the individual components in the directory. I have not touched the CMakeLists.txt in the project, since the documentation states that the defaults are sufficient. What is wrong in my approach?

Question 2: Further down in the output from the compile and build process is a fatal error saying:
"D:/Projects_Local/ESP32_IoT_book/DHT_BUZZER/main/main.c:4:10: fatal error: components/dht/dht.h: No such file or directory", but there is a file dht.h in D:/Projects_Local/ESP32_IoT_book/DGT_BUZZER/components/components/dht. What is wrong in my approach?

Any help is appreciated.

Regards,
Jorgen

Who is online

Users browsing this forum: MicroController and 106 guests