gcc编译动态链接库遇到这些错误:skeleton.c: In function `createJList':
skeleton.c:8: error: request for member `FindClass' in something not a structure or union
skeleton.c:13: error: request for member `GetMethodID' in something not a structure or union
skeleton.c:18: error: request for member `NewObject' in something not a structure or union暂时想不到原因了,有经验的给点提示!
skeleton.c:8: error: request for member `FindClass' in something not a structure or union
skeleton.c:13: error: request for member `GetMethodID' in something not a structure or union
skeleton.c:18: error: request for member `NewObject' in something not a structure or union暂时想不到原因了,有经验的给点提示!
`FindClass'
GetMethodID'
NewObject'
估计用的不对,没有程序,看输出信息猜的
jobject JNICALL createJList(JNIEnv *env){
jclass arraylistClass =NULL;
jmethodID methodID=NULL;
jobject arraylist=NULL;
arraylistClass = (env)->FindClass(env,"java/util/ArrayList");
if(arraylistClass == NULL){
fprintf(stderr,"can not find java/util/ArrayList class.\n");
return NULL;
}
methodID=(env)->GetMethodID(env,arraylistClass,"<init></init>","()V");
if(methodID ==NULL){
fprintf(stderr,"can not get java/util/ArrayList's constructor.\n");
return NULL;
}
arraylist=(env)->NewObject(env,arraylistClass,methodID,"");
if(arraylist==NULL){
fprintf(stderr,"can not construct java/util/ArrayList's instance.\n");
return NULL;
}
return arraylist;
}