esp_http_client.h: No such file or directory
esp_http_client.h: No such file or directory
I am having a weird issue with ESP-IDF. In my project directory if I call esp_http_client from a main or from a library in the same directory It works. But when I shift the library to somewhere else, this particular library can not be imported. I already got RFID, gpio, and wifi libraries set up in my "lib" directory and works well. Any ideas on how I can solve this problem? No issues in CMakeLists because all the other libraries are working. I have tried many ways but I can't progress any further. The examples of http_clients in IDF works because everything is in the main file and my configuration files are derived from the template project of EPS-IDF. If anyone knows please help me to resolve this issue. Thank you in advance.
- Attachments
-
- Screenshot 2021-10-17 213429.png (13.77 KiB) Viewed 9723 times
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: esp_http_client.h: No such file or directory
You say 'no issues in the CMakeLists.txt file'... just to make sure, you have esp_http_client in the REQUIRES and/or PRIV_REQUIRES there? If in doubt, can you post the file?
Re: esp_http_client.h: No such file or directory
Code: Select all
"includePath": [
"${config:idf.espIdfPath}/components/**",
"${config:idf.espIdfPathWin}/components/**",
"${config:idf.espAdfPath}/components/**",
"${config:idf.espAdfPathWin}/components/**",
"${workspaceFolder}/**"
],
my directory is like this.
project
- .vscode
- libs
- main
- CMakeLists.txt
I already created 3 libraries for other tasks. everything works fine. but I simply can't import http_client library inside the lib folder. I can only realize it in the main folder.
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: esp_http_client.h: No such file or directory
Sorry, but that doesn't answer any of the questions I asked... Can you specifically post the contents of the CMakeLists.txt in the component where you are trying to use esp_http_client?
Re: esp_http_client.h: No such file or directory
home directory
under http directory
Hope this is what you were asking for?
Code: Select all
cmake_minimum_required(VERSION 3.5)
set(EXTRA_COMPONENT_DIRS lib)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
Code: Select all
idf_component_register(
SRCS "HTTP.cpp"
INCLUDE_DIRS .
)
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: esp_http_client.h: No such file or directory
Yep. You're missing a REQUIRES/PRIV_REQUIRES line, as I said before. Change the CMakeLists.txt file in the http dir to
Code: Select all
idf_component_register(
SRCS "HTTP.cpp"
INCLUDE_DIRS .
REQUIRES esp_http_client
)
Re: esp_http_client.h: No such file or directory
Thank you. That solved. I have two questions to ask.
1. This is my includes in WIFI library which resides in the same directory as of Http.
but this didn't ask me to add anything to REQUIRES. Why is that?
2. How can I add more REQUIRES? Because I also included cJSON.h but it says no such file. I tried few methods like space separation, comma separation. but it didn't catch that. Thank you
1. This is my includes in WIFI library which resides in the same directory as of Http.
Code: Select all
#include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h"
#include "esp_log.h"
#include "esp_event.h"
#include "esp_wifi.h"
2. How can I add more REQUIRES? Because I also included cJSON.h but it says no such file.
Code: Select all
REQUIRES esp_http_client
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: esp_http_client.h: No such file or directory
I don't know the answer to your first question... On the second one: the delimiter generally is a space, but do note that the thing you need to enter is a component name, which is the same as the base directory the component lives in. For instance, cJSON.h lives in esp-idf/components/json/cJSON/cJSON.h. The component name in this case would be 'json', so you'd need to fill that in.
Re: esp_http_client.h: No such file or directory
thank you so much for your help. I learned a lot from you
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: esp_http_client.h: No such file or directory
No problem, glad I could help!
Who is online
Users browsing this forum: No registered users and 444 guests