opencv头文件不包含在cpp文件android studio中

时间:2018-04-13 12:26:43

标签: android c++ opencv face-recognition

我正在学习OpenCV库,并希望开发一个面部识别应用程序,为此我开始将NDK与android工作室集成,但我被困在这里。

我能够成功地将文本消息从cpp打印到Android框架中的活动

// Cpp Code
    extern "C"
    JNIEXPORT jstring JNICALL
    Java_com_detectface_tasolmyfacerec_utils_Opencv_toastCPPNative(JNIEnv *env, jobject instance) {

        std::string hello = "OpenCV FaceDetection";

        return env->NewStringUTF(hello.c_str());
    }
//Java Code 
public native String toastCPPNative();

但是当开始添加cpp支持的标题时,它们不包括在内并显示红色高亮文本,我想包含那些文件以便我可以使用opencv算法

#include <opencv2/core.hpp>

的CMakeLists.txt

cmake_minimum_required(VERSION 3.4.1)
add_library( # Sets the name of the library.
             facedetection-lib

             # Sets the library as a shared library.
             SHARED

             # Provides a relative path to your source file(s).
             src/main/cpp/facedetection-lib.cpp )


find_library( # Sets the name of the path variable.
              log-lib

              # Specifies the name of the NDK library that
              # you want CMake to locate.
              log )


target_link_libraries( # Specifies the target library.
                       native-lib

                       # Links the target library to the log library
                       # included in the NDK.
                       ${log-lib} )

我也提供截图 look at the red highlighted text

0 个答案:

没有答案