espressif / book-esp32c3-iot-projects

《ESP32-C3 物联网工程开发实战》配套代码
97 stars 29 forks source link

https_server编译时遇到错误fatal error: app_storage.h: No such file or directory #5

Open liv1892 opened 1 year ago

liv1892 commented 1 year ago

../main/app_main.c:27:10: fatal error: app_storage.h: No such file or directory

include "app_storage.h"

      ^~~~~~~~~~~~~~~

compilation terminated. ninja: build stopped: subcommand failed. ninja failed with exit code 1 这是错误的简短说明,缺少了该头文件

ESP-YJM commented 1 year ago

感谢指出,编译错误是由于工程整体目录调整后,相关目录文件没有及时修改导致,你可以先按照如下进行修改,后续我们会修改编译问题。

diff --git a/test_case/https_server/CMakeLists.txt b/test_case/https_server/CMakeLists.txt
index 282f617..5de3489 100644
--- a/test_case/https_server/CMakeLists.txt
+++ b/test_case/https_server/CMakeLists.txt
@@ -5,9 +5,9 @@ cmake_minimum_required(VERSION 3.5)
 add_compile_options(-fdiagnostics-color=always)

 # Add common application components
-set(EXTRA_COMPONENT_DIRS ${CMAKE_CURRENT_LIST_DIR}/../../Project/components/light_driver
-                        ${CMAKE_CURRENT_LIST_DIR}/../../Project/components/button
-                        ${CMAKE_CURRENT_LIST_DIR}/../../Project/components/app_storage
+set(EXTRA_COMPONENT_DIRS ${CMAKE_CURRENT_LIST_DIR}/../../device_firmware/components/light_driver
+                        ${CMAKE_CURRENT_LIST_DIR}/../../device_firmware/components/button
+                        ${CMAKE_CURRENT_LIST_DIR}/../../device_firmware/components/app_storage
                         )

 include($ENV{IDF_PATH}/tools/cmake/project.cmake)
diff --git a/test_case/https_server/main/CMakeLists.txt b/test_case/https_server/main/CMakeLists.txt
index 6b52b75..c6b6f2c 100644
--- a/test_case/https_server/main/CMakeLists.txt
+++ b/test_case/https_server/main/CMakeLists.txt
@@ -5,6 +5,7 @@ set(DEVELOPMENT_BOARD "board_esp32c3_devkitc.h")
 set(COMPONENT_EMBED_TXTFILES "cacert.pem" "prvtkey.pem")

 idf_component_register(SRCS "${srcs}"
-                    INCLUDE_DIRS "${include_dirs}")
+                    INCLUDE_DIRS "${include_dirs}"
+                    EMBED_TXTFILES "${COMPONENT_EMBED_TXTFILES}")