Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NDK - include 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)

The error occurs when ndk try to build .so

Thanks in advance.

like image 794
User Avatar asked Sep 20 '26 02:09

User


1 Answers

LOCAL_C_INCLUDE := /home/nemesis/adt-bundle-linux-x86_64-20140702/OpenCV-2.4.10-android-sdk/sdk/native/jni/include/opencv2

should be

LOCAL_C_INCLUDES := /home/nemesis/adt-bundle-linux-x86_64-20140702/OpenCV-2.4.10-android-sdk/sdk/native/jni/include

ie, it is plural and should point to the location from which the following is a relative path:

#include <opencv2/core/core.hpp>
like image 83
Chris Stratton Avatar answered Sep 21 '26 17:09

Chris Stratton