PlatformIO Community

Platformio for esp32: how to include esp_http_client lib?


#1

Hi all
My first steps on platformio. Seems very interesting.
I have just created a esp32 project that does printf “Hello world”. After compiling and burning, I can see the message on the serial console.
Now I would like to test /make a REST request to a rest server. It seems that esp_hhtp_client lib does that:

But can not reuse this lib. How to insert all the lib code inside platformio project tree?

I have tried:

pio lib search esp_http_client

but not fount. It seems that that lib is not pio lib compliant (easy instalation).

I have also add the main lib directory to the project’s lib directory but then I include the .h file and compiler says not found

Using platformio with atom

Thanks a lot


#2

The documentation says that the lib main dir should be placed in the project’s lib dir. As this lib has multiple subdirs, with a flatness operation, now everything is found


#3

Hello I have the same problem with esp_http_server, i have problems of linking with this:

Linking .pioenvs/featheresp32/firmware.elf
.pioenvs/featheresp32/src/mian.o:(.literal.hello_get_handler+0x4c): undefined reference to httpd_req_get_hdr_value_len' .pioenvs/featheresp32/src/mian.o:(.literal.hello_get_handler+0x54): undefined reference tohttpd_req_get_hdr_value_str’
.pioenvs/featheresp32/src/mian.o:(.literal.hello_get_handler+0x5c): undefined reference to httpd_req_get_url_query_len' .pioenvs/featheresp32/src/mian.o:(.literal.hello_get_handler+0x60): undefined reference tohttpd_req_get_url_query_str’
.pioenvs/featheresp32/src/mian.o:(.literal.hello_get_handler+0x64): undefined reference to httpd_query_key_value' .pioenvs/featheresp32/src/mian.o:(.literal.hello_get_handler+0x68): undefined reference tohttpd_resp_set_hdr’
.pioenvs/featheresp32/src/mian.o:(.literal.hello_get_handler+0x70): undefined reference to httpd_resp_send' .pioenvs/featheresp32/src/mian.o:(.literal.echo_post_handler+0xc): undefined reference tohttpd_req_recv’
.pioenvs/featheresp32/src/mian.o:(.literal.echo_post_handler+0x10): undefined reference to httpd_resp_send_chunk' .pioenvs/featheresp32/src/mian.o:(.literal.ctrl_put_handler+0x18): undefined reference tohttpd_resp_send_err’
.pioenvs/featheresp32/src/mian.o:(.literal.ctrl_put_handler+0x1c): undefined reference to httpd_unregister_uri' .pioenvs/featheresp32/src/mian.o:(.literal.ctrl_put_handler+0x20): undefined reference tohttpd_register_uri_handler’
.pioenvs/featheresp32/src/mian.o:(.literal.start_webserver+0x14): undefined reference to httpd_start' .pioenvs/featheresp32/src/mian.o:(.literal.event_handler+0x18): undefined reference tohttpd_stop’
.pioenvs/featheresp32/src/mian.o: In function hello_get_handler': mian.c:(.text.hello_get_handler+0xc): undefined reference tohttpd_req_get_hdr_value_len’
mian.c:(.text.hello_get_handler+0x29): undefined reference to httpd_req_get_hdr_value_str' mian.c:(.text.hello_get_handler+0x56): undefined reference tohttpd_req_get_hdr_value_len’
mian.c:(.text.hello_get_handler+0x74): undefined reference to httpd_req_get_hdr_value_str' mian.c:(.text.hello_get_handler+0xa1): undefined reference tohttpd_req_get_hdr_value_len’
mian.c:(.text.hello_get_handler+0xbe): undefined reference to httpd_req_get_hdr_value_str' mian.c:(.text.hello_get_handler+0xe4): undefined reference tohttpd_req_get_url_query_len’
mian.c:(.text.hello_get_handler+0x102): undefined reference to httpd_req_get_url_query_str' mian.c:(.text.hello_get_handler+0x12a): undefined reference tohttpd_query_key_value’
mian.c:(.text.hello_get_handler+0x14e): undefined reference to httpd_query_key_value' mian.c:(.text.hello_get_handler+0x172): undefined reference tohttpd_query_key_value’
mian.c:(.text.hello_get_handler+0x19d): undefined reference to httpd_resp_set_hdr' mian.c:(.text.hello_get_handler+0x1ae): undefined reference tohttpd_resp_set_hdr’
mian.c:(.text.hello_get_handler+0x1c4): undefined reference to httpd_resp_send' mian.c:(.text.hello_get_handler+0x1ce): undefined reference tohttpd_req_get_hdr_value_len’
.pioenvs/featheresp32/src/mian.o: In function echo_post_handler': mian.c:(.text.echo_post_handler+0x1a): undefined reference tohttpd_req_recv’
mian.c:(.text.echo_post_handler+0x34): undefined reference to httpd_resp_send_chunk' mian.c:(.text.echo_post_handler+0x86): undefined reference tohttpd_resp_send_chunk’
.pioenvs/featheresp32/src/mian.o: In function ctrl_put_handler': mian.c:(.text.ctrl_put_handler+0xa): undefined reference tohttpd_req_recv’
mian.c:(.text.ctrl_put_handler+0x23): undefined reference to httpd_resp_send_err' mian.c:(.text.ctrl_put_handler+0x4f): undefined reference tohttpd_unregister_uri’
mian.c:(.text.ctrl_put_handler+0x5a): undefined reference to httpd_unregister_uri' mian.c:(.text.ctrl_put_handler+0x7b): undefined reference tohttpd_register_uri_handler’
mian.c:(.text.ctrl_put_handler+0x86): undefined reference to httpd_register_uri_handler' mian.c:(.text.ctrl_put_handler+0x92): undefined reference tohttpd_resp_send’
.pioenvs/featheresp32/src/mian.o: In function start_webserver': mian.c:(.text.start_webserver+0x30): undefined reference tohttpd_start’
mian.c:(.text.start_webserver+0x4f): undefined reference to httpd_register_uri_handler' mian.c:(.text.start_webserver+0x5b): undefined reference tohttpd_register_uri_handler’
mian.c:(.text.start_webserver+0x66): undefined reference to httpd_register_uri_handler' .pioenvs/featheresp32/src/mian.o: In functionevent_handler’:
mian.c:(.text.event_handler+0xa6): undefined reference to `httpd_stop’
collect2: error: ld returned 1 exit status
*** [.pioenvs/featheresp32/firmware.elf] Error 1

Have you found some solution?

Tranks!!!


#4

State your full platformio.ini and the code you’re running for reproduction.