Help with using cURL in ESP32 Project
Posted: Sun May 26, 2024 1:23 am
Hello, I'm working on an ESP32 project and having some trouble integrating cURL.
Initially, my project structure looked like this:
I had some problems getting my project to detect curl, so to make it work I added the curl folder to my project:
This change works fine for me but now I have the problem that it does not detect some curl functions:
undefined reference to 'curl_easy_init'
undefined reference to 'curl_easy_setopt'
These are some examples, in my APImain.c file I have this:
I tried adding things to the CMake files but despite several tests I still get the same error
I was thinking if I should add the curl folder or files to the expressif tools.
Initially, my project structure looked like this:
Code: Select all
Project
├── MyLibs/
│ ├── rol.h
│ ├── web.h
│ ├── APImain.h
├── second/
│ ├── Rol/
│ │ ├── roles.c
│ │ └── CMakeLists.txt
│ └── API/
│ ├── APImain.c
│ └── CMakeLists.txt
├── main/
│ ├── main.c
│ └── CMakeLists.txt
└── CMakeLists.txt
Code: Select all
Project
├── MyLibs/
│ ├── cURL/
│ │ ├── include/
│ │ │ ├── curl/
│ │ │ │ ├── curl.h
│ │ │ │ └── ...
│ │ │ ├── lib/
│ │ │ │ ├── libcurl.a
│ │ │ │ └── ...
│ │ │ └── ...
│ │ └── ...
│ ├── rol.h
│ ├── web.h
│ ├── APImain.h
├── second/
│ ├── Rol/
│ │ ├── roles.c
│ │ └── CMakeLists.txt
│ └── API/
│ ├── APImain.c
│ └── CMakeLists.txt
├── main/
│ ├── main.c
│ └── CMakeLists.txt
└── CMakeLists.txt
undefined reference to 'curl_easy_init'
undefined reference to 'curl_easy_setopt'
These are some examples, in my APImain.c file I have this:
Code: Select all
#include "cURL/include/curl/curl.h"
Code: Select all
c:/users/luis_/.espressif/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(APImain.c.obj):(.literal.POSTdata+0x3c): undefined reference to `curl_easy_init'