使用< math.h>中的任何函数时,android上的链接错误不满意;在本地人(NDK) [英] unsatisfied link error on android when using any function from <math.h> in natives (NDK)
本文介绍了使用< math.h>中的任何函数时,android上的链接错误不满意;在本地人(NDK)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试在Android上启动基于C ++的应用程序时,我遇到了著名的无法满足的链接错误.我尝试了几种解决方法,发现当我注释掉对math.h函数的所有调用(例如sin
或sqrt
)时,应用程序将正确启动.
I'm getting famous unsatisfied link error when I'm trying to launch my C++ based app on Android. I've tried several ways to solve this out and found out that when I comment out all calls to math.h functions (like sin
or sqrt
) the application launches correctly.
我只将我的.so库与libGLESv1_CM.a
链接在一起,在Java中,我称之为:
I am linking my .so library only with libGLESv1_CM.a
and in Java I call:
static {
try
{
System.loadLibrary("GLESv1_CM");
System.loadLibrary("Game");
}
catch(UnsatisfiedLinkError error)
{
Log.e("MyGame", "Failed to launch game");
}
}
我想念什么吗?
推荐答案
您应将其与libm链接.将以下内容添加到您的Android.mk文件中:
You should link it with libm. Add the following to your Android.mk file:
LOCAL_LDLIBS += -lm
这篇关于使用< math.h>中的任何函数时,android上的链接错误不满意;在本地人(NDK)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文