ESP32-IDF编译问题

Posted knowform

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ESP32-IDF编译问题相关的知识,希望对你有一定的参考价值。

问题:

include/asio/impl/src.hpp:22,
                 from /home/user/esp-idf-v3.2/esp-idf/components/asio/asio/asio/src/asio.cpp:11:
/opt/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/stdlib.h:155:44: error: expected initializer before '__result_use_check'
 void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size(2)
                                            ^~~~~~~~~~~~~~~~~~
/opt/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/stdlib.h:340:52: error: expected initializer before '__alloc_align'
 void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1)
                                                    ^~~~~~~~~~~~~
/home/user/esp-idf-v3.2/esp-idf/make/component_wrapper.mk:285: recipe for target 'asio/asio/src/asio.o' failed
make[1]: *** [asio/asio/src/asio.o] Error 1
/home/user/esp-idf-v3.2/esp-idf/make/project.mk:530: recipe for target 'component-asio-build' failed
make: *** [component-asio-build] Error 2

解决:

xtensa-esp32-elf-gcc版本问题

 

问题:

/home/user/esp-idf-v3.2/esp-idf/examples/get-started/ESP32_CAMERA_QR-master/main/app_main.c:140:97: error: 'handle_jpg' undeclared (first use in this function)
 p_register_handler(server, "/jpg", HTTP_GET, HTTP_HANDLE_RESPONSE, &handle_jpg,
                                                                     ^
/home/user/esp-idf-v3.2/esp-idf/components/esp32/include/esp_err.h:117:31: note: in definition of macro 'ESP_ERROR_CHECK'
         esp_err_t __err_rc = (x);                                       \\
                               ^
/home/user/esp-idf-v3.2/esp-idf/examples/get-started/ESP32_CAMERA_QR-master/main/app_main.c:142:104: error: 'handle_jpg_stream' undeclared (first use in this function)
 ter_handler(server, "/jpg_stream", HTTP_GET, HTTP_HANDLE_RESPONSE, &handle_jpg_
                                                                     ^
/home/user/esp-idf-v3.2/esp-idf/components/esp32/include/esp_err.h:117:31: note: in definition of macro 'ESP_ERROR_CHECK'
         esp_err_t __err_rc = (x);                                       \\
                               ^
/home/user/esp-idf-v3.2/esp-idf/examples/get-started/ESP32_CAMERA_QR-master/main/app_main.c: At top level:
/home/user/esp-idf-v3.2/esp-idf/examples/get-started/ESP32_CAMERA_QR-master/main/app_main.c:150:30: error: unknown type name 'http_context_t'
 static esp_err_t write_frame(http_context_t http_ctx)
                              ^
/home/user/esp-idf-v3.2/esp-idf/examples/get-started/ESP32_CAMERA_QR-master/main/app_main.c:160:34: error: unknown type name 'http_context_t'
 static void handle_grayscale_pgm(http_context_t http_ctx, void* ctx)
                                  ^
/home/user/esp-idf-v3.2/esp-idf/examples/get-started/ESP32_CAMERA_QR-master/main/app_main.c:190:28: error: unknown type name 'http_context_t'
 static void handle_rgb_bmp(http_context_t http_ctx, void* ctx)
                            ^
/home/user/esp-idf-v3.2/esp-idf/examples/get-started/ESP32_CAMERA_QR-master/main/app_main.c:216:24: error: unknown type name 'http_context_t'
 static void handle_jpg(http_context_t http_ctx, void* ctx)
                        ^
/home/user/esp-idf-v3.2/esp-idf/examples/get-started/ESP32_CAMERA_QR-master/main/app_main.c:234:35: error: unknown type name 'http_context_t'
 static void handle_rgb_bmp_stream(http_context_t http_ctx, void* ctx)
                                   ^
/home/user/esp-idf-v3.2/esp-idf/examples/get-started/ESP32_CAMERA_QR-master/main/app_main.c:277:31: error: unknown type name 'http_context_t'
 static void handle_jpg_stream(http_context_t http_ctx, void* ctx)

解决:

 git clone https://github.com/igrr/esp32-http-server.git

以上是关于ESP32-IDF编译问题的主要内容,如果未能解决你的问题,请参考以下文章

linux下使用eclipse打开esp32工程文件,并进行编译下载。

ESP-micropython 建立IDF环境,编译自己的固件

ESP32-IDF 05-3 WIFI-esp32获取网络时间

ESP32-IDF05-1 WIFI-esp32联网

ESP32-IDF 05-2 WIFI-esp32获取温度和天气信息

ESP32 ESP-IDF开发环境搭建,Windows下基于ESP-IDF | Cmake | VScode插件的 ESP32 开发环境搭建