我试图包含一个库,它使用诸如blah.hpp之类的文件作为“组件”,并使用esp32 idf编译它们。
我在项目中创建了components子目录,并将库复制到components目录的子目录中。如果我用锅炉板
component.mk
文件编译器看不到后缀为.hpp的文件。如果我将文件重命名为
blah.hpp
到
blah.cpp
编译器确实看到
废话cpp
文件,所以它只是没有看到文件
.hpp
后缀
我尝试添加以下component.mk文件(我注意到
here
)但后来我犯了以下错误。
make[1]: *** No rule to make target '/home/john/development/esp/ble_test2/components/rxcpp/./rx-sources.o', needed by 'librxcpp.a'. Stop.
这是我正在尝试使用的component.mk文件(添加了上面提到的行)。
#
# Main component makefile.
#
# This Makefile can be left empty. By default, it will take the sources in the
# src/ directory, compile them and link them into lib(subdirectory_name).a
# in the build directory. This behaviour is entirely configurable,
# please read the ESP-IDF documents if you need to do this.
COMPONENT_ADD_INCLUDEDIRS=.
COMPONENT_OBJS += $(foreach compsrcdir,$(COMPONENT_SRCDIRS),$(patsubst %.hpp,%.o,$(wildcard $(COMPONENT_PATH)/$(compsrcdir)/*.hpp)))
## Uncomment the following line to enable exception handling
CXXFLAGS+=-fexceptions
CXXFLAGS+= -std=c++11
这似乎是一个简单的修复方法,我确实看到esp32 idf中的组件也使用诸如blah.hpp之类的文件
here
,但我无法设置使我的编译可用的选项。
顺便说一句,不知道在esp32上尝试使用rxcpp是否是个好主意,但我很好奇它是否能工作:)