For some reason I want to use FreeImage library in my android ndk project ,but while I am building this static library with ndk-build, It compiled the source quite OK, but failed during the link step, with the undefined reference to somefunction error.
After a lot search I add the LOCAL_ALLOW_UNDEFINED_SYMBOLS=true to the Android.mk.
But at last this method demonstrate to be a wrong solution for most time, it just give you a false sense of security, because it will give you a big unsatisfiedLinkError at run time .
The really reason for the line error is a order-of-linking problem.
his looks like an order-of-linking issue to me.
Your command line is:
arm-linux-androideabi-g++ -Wl,-soname,libFinal.so -shared \
libBase.a libFramework.a libGraphics.a libPlatform.a -o libFinal.so
and the error is
libPlatform.a(ATexture.o): In function `ATexture':
ATexture.cpp:9: undefined reference to `TextureRenderer'
ATexture.cpp:9: undefined reference to `TextureRenderer'
TextureRenderer is in Graphics. But libGraphics is before libPlatform on the command line. g++ will search each library on the command line in the order they are given, loading functions to resolve external references. It will read libGraphics once, load the functions that resolve external references and move on to libPlatform.
Try changing LOCAL_STATIC_LIBRARIES := $(MY_LOCAL_STATIC_LIBRARIES)
toLOCAL_STATIC_LIBRARIES := Platform Graphics Framework Base
and see how you get on
http://stackoverflow.com/questions/4765465/android-ndk-two-static-libraries-and-linking
分享到:
相关推荐
解决Android下getifaddrs和freeifaddrs undefined reference 的问题,即android下的c实现
Android NDK 安装以及 HelloWorld!测试
NDK提供了一系列的工具,帮助开发者快速开发C(或C++)的动态库,并能自动将so和java应用一起打包成apk,并集成了交叉编译器,并提供了相应的mk文件隔离CPU、平台、ABI等差异,开发人员只需要简单修改mk文件
Android NDK 开发时需要的 常用的JNI API
博客名称 : 【Android NDK 开发】在 C 代码中获取 Android 系统信息 ( NDK 项目创建 | NDK 配置 | 获取 Android 系统版本号 ) 博客地址 : https://hanshuliang.blog.csdn.net/article/details/102933704
使用Android NDK编译Android平台的eXosip库,有静态库和动态库。
android ndk 使用方法android ndk 使用方法
这个虽然只是个简单的jnidemo、但是涵盖了Android.mk 和Application.mk 的原理 重点是Android NDK编译的理解 mac 系统下 切换到jni目录,然后呢个 ndk-build
Android NDK Game Development Cookbook A systematic guide consisting of over 70 recipes which focus on helping you build portable mobile games and aims to enhance your game development skills with ...
ndk网盘下载,方便不能科学上网的同学下载。包含Windows和Mac版本。版本号r14-r20,全部下载搬运自谷歌Android官网。下载后是一个文本文件,用文本编辑器打开即可看到网盘下载地址。
android-ndk(android-ndk-r23b-windows.zip)适用于Windows系统
Eclipse集成Android NDK说明 1 2 为什么要用NDK? 2 3 为什么要集成? 2 4 怎样操作? 2 4.1 预备条件 2 4.1.1 Cygwin 2 4.1.2 Eclipse 2 4.1.3 Eclipse CDT 3 4.1.4 Android SDK 3 4.1.5 Android NDK 3 ...
"Android NDK 入门指南" Android NDK (Native Development Kit) 是 Android 平台中的一款工具集,允许开发者使用 C 语言和 C++ 语言编写原生代码,并将其集成到 Java 应用程序中。通过使用 NDK,开发者可以充分利用...
valgrind for android NDK, 由国外相关资源整理,并亲测试可用,只支持 arm 架构.
android ndk详细介绍
android-ndk(android-ndk-r25b-darwin.zip)适用于macOS系统
Android NDK 开发教程 三 Hello JNI 示例
android ndk android ndk android ndk android ndk android ndk android ndk
android-ndk(android-ndk-r26b-windows.zip)适用于Windows系统
该资源包含了一个用android实现的androidndk文档,简单易懂!