第八章
编译时报错:fatal error: app_storage.h: No such file or directory
#include "app_storage.h"
原因:CMakeList文件中的链接位置有误,找不到头文件
位置:book-esp32c3-iot-projects-main/test_case/tcp_socket
后续发现:所有的涉及到链接按钮、灯光、NVS驱动的位置都有误,包括test_case中的(broadcast_discovery,coap,gatt_server,https_server,local_control,mdns_discovery,multicast_discovery,tcp_socket,udp_socket)下的CMakeList文件
原代码为
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
)
补:8.3.4 CoAP协议中提到的代码
编译报错:error: implicit declaration of function 'app_storage_init';
位置:book-esp32c3-iot-projects-main/test_case/coap
原因:app_main.c文件中缺少头文件app_storage.h
需要补
#include "app_storage.h"