我是使用 JNI 的新手,所以我试图从 C 中的本机库中获取 adouble
和 anunsigned int
并将值返回到我的 java 端,但我不断从 Android Studio 收到以下错误
Error:(111, 37) error: called object type 'double' is not a function or function pointer
Error:(117, 43) error: called object type 'unsigned int' is not a function or function pointer
Error:(220, 19) error: functions that differ only in their return type cannot be overloaded
这是我的代码:
double SuperpoweredExample::getPosition() {
double pos = playerA->positionMs();
return pos;
}
unsigned int SuperpoweredExample::getDuration() {
unsigned int dur = playerA->durationMs();
return dur;
}
虽然这是外部 C 结构
JNIEXPORT jdouble Java_com_superpowered_crossexample_MainActivity_getPosition(JNIEnv *javaEnvironment, jobject self) {
return example->getPosition();
}
JNIEXPORT jint Java_com_superpowered_crossexample_MainActivity_getDuration(JNIEnv *javaEnvironment, jobject self) {
return example->getDuration();
}
请各位,我将不胜感激任何帮助......提前谢谢你