Reputation: 33
I am trying to merge my separate SD card and MQTT code in an ESP-IDF project to enable functionality for sending data from the SD card to the cloud via MQTT. Both the SD card and MQTT code work correctly when run individually. However, when I attempt to merge them, I encounter the following errors:
C:/Users/Admin/Desktop/sdspi/main/wifi.c:2:10: fatal error: esp_wifi.h: No such file or directory
2 | #include "esp_wifi.h"
| ^~~~~~~~~~~~
C:/Users/Admin/Desktop/sdspi/main/mqtt.c:5:10: fatal error: mqtt_client.h: No such file or directory
5 | #include "mqtt_client.h"
| ^~~~~~~~~~~~~~
C:/Users/Admin/Desktop/sdspi/main/sd_card_example_main.c:17:10: fatal error: nvs_flash.h: No such file or directory
17 | #include "nvs_flash.h"
| ^~~~~~~~~~~~~
CMakeLists.txt of separate MQTT.
idf_component_register(SRCS "app_main.c" "mqtt.c" "json.c" "wifi.c" "cJSON.c"
INCLUDE_DIRS ".")
CMakeLists.txt of separate SD_CARD.
set(srcs "sd_card_example_main.c")
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS "."
REQUIRES fatfs sd_card json
WHOLE_ARCHIVE)
CMakeLists.txt of merged project mqtt_ssl.
set(srcs "sd_card_example_main.c" "wifi.c" "mqtt.c" "cJSON.c" "json.c")
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS "."
REQUIRES fatfs sd_card json
WHOLE_ARCHIVE)
I have added these header files to my project, but I still receive these errors. I can see that the folders for these header files are present in the components directory of ESP-IDF. Can anyone help me resolve this issue? Thank you!
Upvotes: 1
Views: 176
Reputation: 577
I've resolved my issue, that produced the very same error message by updating a dependency:
I use esp32-wifi-manager, originally from https://github.com/tonyp7/esp32-wifi-manager, which doesn't seem to be maintained any more and isn't compatible with idf 5.
I changed my version to https://github.com/huardti/esp32-wifi-manager, now the inlclude works. So, maybe one of your dependencies is causing the problem.
Upvotes: 0