NDK - include lib error
I need your help because it drives me crazy. What cause my error?
The error is
jni/algorithm.cpp:4:33: fatal error: opencv2/core/core.hpp: No such file or directory #include <opencv2/core/core.hpp>
^ compilation terminated. make: *** [obj/local/arm64-v8a/objs/algorithm/algorithm.o] Error 1
My algorithm.cpp is:
#include <jni.h>
#include <string.h>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"
using namespace std;
using namespace cv;
extern "C"
{
JNIEXPORT jlong JNICALL Java_com_example_hematoma_MainActivity_fce(JNIEnv *env, jobject obj, jlong matimage)
{
Mat *jni_image = (Mat*) matimage;
return (jlong)jni_image;
}
}
My Android.mk is:
LOCAL_PATH := $(call my-dir)
include /home/nemesis/adt-bundle-linux-x86_64-20140702/OpenCV-2.4.10-android-sdk/sdk/native/jni/OpenCV.mk
include $(CLEAR_VARS)
LOCAL_MODULE := algorithm
LOCAL_SRC_FILES := algorithm.cpp
LOCAL_C_INCLUDE := /home/nemesis/adt-bundle-linux-x86_64-20140702/OpenCV-2.4.10-android-sdk/sdk/native/jni/include/opencv2/core/core.hpp
LOCAL_C_INCLUDE += /home/nemesis/adt-bundle-linux-x86_64-20140702/OpenCV-2.4.10-android-sdk/sdk/native/jni/include/
include $(BUILD_SHARED_LIBRARY)
Of course I have also Application.so but I dont mention it here because I think it dont cause the error.
The error occurs when ndk try to build .so
Shouldn't you call CLEAR_VARS before including OpenCV.mk? You do not need to set LOCAL_C_INCLUDE manually (it is actually LOCAL_C_INCLUDES), because it will be modified inside OpenCV.mk.
Your file should look like this:
Also, as far as I know, arm64-v8 is not supported in OpenCV yet.
Thank you very much :) you are right. I have also asked here http://stackoverflow.com/questions/29... . It is already fixed. The problem was missing S in word INCLUDES