Vote count:
0
I am using opencv C++ code so that i can change some code stuff and compile it and gets the result. The issue is i'm able to use functions of opencv c++ in my JNI interface function. I'm able to use these functions after adding there header's at top of code. When i am running a compilation i'm getting undefined reference error.
I'm doing this for android coding.
The error are given below(Few errors):
Volumes/MAC/Farrakh/Software-Setups/android-ndk-r10c/toolchains/arm-linux-androideabi-
4.6/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-
androideabi/bin/ld: ./obj/local/armeabi/objs/opencvtest/native.o: in function
cv::Mat::release():jni/opencv2/core/mat.hpp:366: error: undefined reference to
'cv::Mat::deallocate()'
/Volumes/MAC/Farrakh/Software-Setups/android-ndk-r10c/toolchains/arm-linux-androideabi-
4.6/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-
androideabi/bin/ld: ./obj/local/armeabi/objs/opencvtest/native.o: in function
Java_com_whizpool_opencvtest_MainActivity_imread_11:jni/native.cpp:14: error: undefined reference
to 'cv::imread(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&,
int)'
/Volumes/MAC/Farrakh/Software-Setups/android-ndk-r10c/toolchains/arm-linux-androideabi-
4.6/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-
androideabi/bin/ld: ./obj/local/armeabi/objs/opencvtest/native.o: in function
Java_com_whizpool_opencvtest_MainActivity_imread_11:jni/opencv2/core/mat.hpp:277: error:
undefined reference to 'cv::fastFree(void*)'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/libopencvtest.so] Error 1
I tried so many things got from google but i did not get any result.
Below is JNI code that is used to call Opencv C++ code.
#include "com_whizpool_opencvtest_MainActivity.h"
#include <opencv/cv.h>
#include <opencv/highgui.h>
using namespace cv;
extern "C"
{
JNIEXPORT jlong JNICALL Java_com_whizpool_opencvtest_MainActivity_imread_11(JNIEnv *env, jclass obj, jstring string)
{
const char *w_buf = env->GetStringUTFChars(string, 0);
Mat imgMat = imread("abc", 0);
return 0;
}
}
asked 32 secs ago
OpenCV Undefined reference
Aucun commentaire:
Enregistrer un commentaire