首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >链接.a (静态) Libs

链接.a (静态) Libs
EN

Stack Overflow用户
提问于 2016-11-01 10:36:16
回答 1查看 6.7K关注 0票数 6

我正在使用AndroidStudio2.2.2与cmake和Android。链接.a库(静态库)有问题。

这是我的cmake:

代码语言:javascript
运行
复制
# Sets the minimum version of CMake required to build the native
# library. You should either keep the default value or only pass a
# value of 3.4.0 or lower.

cmake_minimum_required(VERSION 3.4.1)

set(CMAKE_VERBOSE_MAKEFILE on)

# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds it for you.    
# Gradle automatically packages shared libraries with your APK.  

add_library(lib_webp SHARED IMPORTED )
set_target_properties(lib_webp PROPERTIES IMPORTED_LOCATION
src/main/jni/${ANDROID_ABI}/libwebp.so)


add_library( # Sets the name of the library.
         game-lib

         # Sets the library as a shared library.
         SHARED

         # Provides a relative path to your source file(s).
         # Associated headers in the same location as their source
         # file are automatically included.
         src/main/cpp/main.cpp
         src/main/cpp/android_native_app_glue.c            
         )


target_include_directories(game-lib PRIVATE
 ../../../../libs/headers/android
)

include_directories($ENV{NDK_MODULE_PATH}/sources/android/native_app_glue/)

# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in the
# build script, prebuilt third-party libraries, or system libraries.

target_link_libraries( # Specifies the target library.
                   game-lib

                   # Links the target library to the log library
                   # included in the NDK.
                   # ${log-lib}                        


                     # Specifies the name of the NDK library that
                     # you want CMake to locate.
                     log                        
                     android
                     OpenSLES
                     z
                     GLESv2
                     EGL
                     dl                         
                  )

add_definitions(-g -DANDROID -Wno-write-strings -fsigned-char -Wno-conversion-null)

TARGET_LINK_LIBRARIES(game-lib libtheoraplayer.a)

我的链接器报告一个错误

arm-linux-androideabi/bin\ld:错误:找不到-ltheoraplayer 错误:对“TheoraVideoManager::TheoraVideoManager(Int)”的未定义引用

这是libincaplayer.a.有人有类似的问题吗?知道怎么解决这个问题吗?

我在那个位置有一个静态的lib理论家。一个礼物。我甚至还有共享库,libtheoraplayer.so,但我也不能链接它。

如有任何建议,将不胜感激。

干杯。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-09 12:00:30

贴出答案。正如Tsyvarev所说,库的非绝对文件名的问题。当我使用粗糙的路径时,它就像一种魅力。

谢谢。干杯。

票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40358365

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档