我正在尝试将外部库添加到我的项目中。
我的项目结构如下所示:
-project
-- main
--- main.c
--- displayfunctions.c (where i implement my Displayfunctions based on the library)
--- 2 other .c files which got nothing to do with my Display
--- CMakeLists.txt
-- components
--- displaylibrary
---- CMAKELists.txt
---- all displayrelevant librarys pngle.c fontx.c etc..
---- include
----- all corresponding header files pngle.h fontx.h etc.
我在 project/components/displaylibrarys 中的 CMakeLists.txt 文件如下所示:
idf_component_register(SRCS "pngle.c" "decode_jpeg.c" "decode_png.c" "fontx.c" "ili9340.c"
INCLUDE_DIRS "include" )
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
当我尝试编译我的项目时,我收到以下错误消息:
../components/Displaylibrarys/fontx.c:7:10: fatal error: esp_spiffs.h: No such file or directory #include "esp_spiffs.h"
所以显然我的编译器没有将我的外部库中包含的 esp-idf 库与实际的 esp-idf 库链接起来。我也用这种方法试过
idf_component_register(SRCS "pngle.c" "decode_jpeg.c" "decode_png.c" "fontx.c" "ili9340.c"
INCLUDE_DIRS "include"
REQUIRES esp_spiffs)
但没有结果。我应该如何正确地告诉我的编译器它知道这个库?