ESP-IDF v4.1怎么生成静态库和调用静态库
Posted: Fri Sep 25, 2020 3:42 am
by elegoqq
请指教,多谢了
Re: ESP-IDF v4.1怎么生成静态库和调用静态库
Posted: Fri Sep 25, 2020 9:42 am
by ESP_morris
Re: ESP-IDF v4.1怎么生成静态库和调用静态库
Posted: Sat Sep 26, 2020 2:17 am
by elegoqq
这个方法可行,非常感谢!
Re: ESP-IDF v4.1怎么生成静态库和调用静态库
Posted: Sat Sep 26, 2020 2:51 am
by elegoqq
按下面的方法写,是可以调用simple_math库
add_library(simple_math STATIC
"math_lib/myadd.c"
"math_lib/mysub.c")
target_link_libraries(${COMPONENT_LIB} PUBLIC "simple_math")
但是把add_library删除只保留target_link_libraries就找不到simple_math库
target_link_libraries(${COMPONENT_LIB} PUBLIC "simple_math")
报错:ld.exe: cannot find -lsimple_math
实际上在build\esp-idf\main\路径下有已经生成的libsimple_math.a,该怎样找到它呢?
Re: ESP-IDF v4.1怎么生成静态库和调用静态库
Posted: Mon Sep 28, 2020 2:40 am
by elegoqq
库生成了,也放到了main路径下,链接时找不到,这是什么原因?
GATT_SERVER/main/libsimple_math.a
GATT_SERVER/main/CMakeLists.txt 书写如下
target_link_libraries(${COMPONENT_LIB} PUBLIC "simple_math")