I have a 2D Java double array:
double[][] jdestination_list = new double[][];
How do I convert this to:
vector<vector<double>> destinationListCpp;
My JNI call is as follows:
extern "C"
JNIEXPORT void JNICALL
Java_JNI_Call(JNIEnv *env, jobject thiz, jobjectArray jdestination_list,)
// always on the lookout for null pointers. Everything we get from Java
// can be null.
jsize OuterDim = jdestination_list ? env->GetArrayLength(jdestination_list) : 0;
std::vector<std::vector<double> > destinationListCpp(OuterDim);
for(jsize i = 0; i < OuterDim; ++i) {
jdoubleArray inner = static_cast<jdoubleArray>(env->GetObjectArrayElement(jdestination_list, i));
// again: null pointer check
if(inner) {
// Get the inner array length here. It needn't be the same for all
// inner arrays.
jsize InnerDim = env->GetArrayLength(inner);
destinationListCpp[i].resize(InnerDim);
jdouble *data = env->GetDoubleArrayElements(inner, 0);
std::copy(data, data + InnerDim, destinationListCpp[i].begin());
env->ReleaseDoubleArrayElements(inner, data, 0);
}
}
I keep getting:
undefined reference to void Clas::Java_JNI_Call
Any suggestions on how this can be done?