Challenges: finished Android.mk and Application.mk file, then compiled using cygwin + NDK
Always encounter the following compilation errors:
fatal error: opencv2/core.hpp: No such file or directory
#include "opencv2/core.hpp"
Online tried many methods do not work.
The final solution to the problem is: the opencv and opencv2 folder to this directory:
D:\android-ndk-r17c\sysroot\usr\include
Then compile it passed.
Because the introduction of opencv code is written like this:
#include "opencv2/core.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/objdetect/objdetect.hpp" #include "opencv2/ml/ml.hpp" #include "opencv2/imgproc/imgproc.hpp"
The compiler can go to find their own path to search, it is clear that the search path is the path NDK, so this method worked.
This method may not be the best solution to the problem, but this is a work of.
Hoping to find a better way.
Reference blog: https://blog.csdn.net/x397794823/article/details/51122742