Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error:(6, 10) fatal error: 'opencv2/opencv.hpp' file not found

I know that there are many threads that have some solution for this problem but I did not managed to resolve my issue with non of them.

I spent like a few days already on this compile error and still no success.

I use Android Studio and opencv 3.3.1

I got opencv .a files placed under jniLibs. I got .h file under jni with heder like this

#include "opencv2/opencv.hpp"

If I remove that include everything builds and I am also able to call cpp methods from java via JNI. But when it comes to this include it seems like something is not connected correctly

inside my CMakeLists.txt i have this

cmake_minimum_required(VERSION 3.4.0)

set(OpenCV_DIR /usr/local/Cellar/opencv/3.3.1_1/share/OpenCV)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules)

include_directories(
    ${CMAKE_SOURCE_DIR}/include
    /usr/local/Cellar/opencv/3.3.1_1/ )

find_package( OpenCV REQUIRED )

My biggest problem I this moment is I do not know how to locate the problem :(. I do not know if my CMakeList.txt is wrong, or build.gradle or what else... Please help me find the problem

When I build with android studio all I got is line

Error:(6, 10) fatal error: 'opencv2/opencv.hpp' file not found

Thanks

Error:(6, 10) fatal error: 'opencv2/opencv.hpp' file not found

I know that there are many threads that have some solution for this problem but I did not managed to resolve my issue with non of them.

I spent like a few days already on this compile error and still no success.

I use Android Studio and opencv 3.3.1

I got opencv .a files placed under jniLibs. I got .h file under jni with heder like this

#include "opencv2/opencv.hpp"

If I remove that include everything builds and I am also able to call cpp methods from java via JNI. But when it comes to this include it seems like something is not connected correctly

inside my CMakeLists.txt i have this

cmake_minimum_required(VERSION 3.4.0)

set(OpenCV_DIR /usr/local/Cellar/opencv/3.3.1_1/share/OpenCV)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules)

include_directories(
    ${CMAKE_SOURCE_DIR}/include
    /usr/local/Cellar/opencv/3.3.1_1/ )

find_package( OpenCV REQUIRED )

My biggest problem I this moment is I do not know how to locate the problem :(. I do not know if my CMakeList.txt is wrong, or build.gradle or what else... Please help me find the problem

When I build with android studio all I got is line

Error:(6, 10) fatal error: 'opencv2/opencv.hpp' file not found

Thanks

edit1: for the SET(OpenCV_DIR "D:/libs/opencv-3.3/build/") comment

I am on Mac not on windows so my paths i little different I got

/usr/local/Cellar/opencv/3.3.1_1

and inside this path I got

INSTALL_RECEIPT.json LICENSE              README.md            bin                  include              lib                  share

but not build