ESP-IDF v4.1怎么生成静态库和调用静态库
-
- Posts: 290
- Joined: Wed Sep 05, 2018 6:23 am
Re: ESP-IDF v4.1怎么生成静态库和调用静态库
按下面的方法写,是可以调用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,该怎样找到它呢?
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怎么生成静态库和调用静态库
库生成了,也放到了main路径下,链接时找不到,这是什么原因?
GATT_SERVER/main/libsimple_math.a
GATT_SERVER/main/CMakeLists.txt 书写如下
target_link_libraries(${COMPONENT_LIB} PUBLIC "simple_math")
GATT_SERVER/main/libsimple_math.a
GATT_SERVER/main/CMakeLists.txt 书写如下
target_link_libraries(${COMPONENT_LIB} PUBLIC "simple_math")
Who is online
Users browsing this forum: No registered users and 53 guests