编译出错,不知道是什么原因,麻烦大家帮忙看看
debian linux, jdk1.6
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include "GDA.h"
__attribute ((constructor)) void init_func(){
srand((unsigned)time(NULL));
printf("seed setted!\n");
}
JNIEXPORT jdoubleArray JNICALL
Java_GDA_genDoubleArray (JNIEnv *env, jclass clazz, jint length){
jdoubleArray gen_arr=env->NewDoubleArray(length);
if (gen_arr==NULL) {
fprintf(stderr, "cannot create double array!\n");
return NULL;
}
double tmp[length];
for (int i=0; i<length; i++)
tmp[i]=rand()/(double)RAND_MAX;
env->SetDoubleArrayRegion(gen_arr, 0, length,tmp);
return gen_arr;
}
hu@forhu-debian:~/Java code/JNI code/GenDoubleArr$ gcc -std=c99 -shared -o /home/hu/lib/libGenDoubleArr.so GDA.c
GDA.c: In function ‘Java_GDA_genDoubleArray’:
GDA.c:13:26: error: request for member ‘NewDoubleArray’ in something not a structure or union
GDA.c:21:5: error: request for member ‘SetDoubleArrayRegion’ in something not a structure or union
报错说不存在这个成员,但是不应该啊,oracle的手册上的文档显示这个结构体是有这个成员的。希望写过jni的大大帮忙看一下,给给意见
------解决方案--------------------
结贴吧