android JNI之 'GetObjectClass' in something not a structure or union

编译错误提示:
/home/miyuehu/work/WebJsTest/jni/jnitest.c:22: error: request for member ‘GetObjectClass’ in something not a structure or union
/home/miyuehu/work/WebJsTest/jni/jnitest.c:23: error: request for member ‘GetFieldID’ in something not a structure or union

注意:jni.h头文件中对于.c & .cpp采用不同的定义

jclass (JNICALL *GetObjectClass) (JNIEnv *env, jobject obj);
jclass GetObjectClass(jobject obj) {
return functions->GetObjectClass(this,obj);
}

对于*.c
jclass test_class = (*env)->GetObjectClass(env, obj);
jfieldID id_num = (*env)->GetFieldID(env, test_class, “num”, “I”);

对于 *.cpp
jclass test_class = env->GetObjectClass(obj);
jfieldID id_num = env->GetFieldID(test_class, “num”, “I”);

你可能感兴趣的:(android,jni)