Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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