【发布时间】:2021-12-02 08:32:55
【问题描述】:
我正在尝试将外部库添加到我的项目中。
我的项目结构如下:
-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)
但没有结果。我应该如何正确地告诉我的编译器它知道这个库?
【问题讨论】:
-
REQUIRES子句看起来不错,只是组件被称为“spiffs”而不是“esp_spiffs”。 -
哇哦。那完成了工作......我挣扎了2天。非常感谢!!!
-
你为什么转发同样的问题而不是跟进原来的问题? stackoverflow.com/questions/70186133/…
标签: visual-studio-code esp32 directory-structure esp-idf cmakelists-options