title: Android.mk - Include OpenCV directory for native C++ compliation with NDK
body: <p>I'm importing a C++/OpenCV code to an Android app with NDK. First of all, I have to say that I don't have studies in programming, I'm just an amateur developer, so there're many things that I don't manage (specially, things out of coding).</p>
  
  <p>I use QtCreator for my C++/OpenCV code and I wrote this line in my Project.pro:</p>
  
  <pre><code>INCLUDEPATH += path/to/OpenCV/main/dir #OpenCV-3.1.0
  LIBS += -lopencv_core -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc
  </code></pre>
  
  <p>Now, I'm trying to make a "Hello World!" app only to be sure that I can compile with my C++ sources.</p>
  
  <p>According to <a href="https://developer.android.com/ndk/guides/android_mk.html" rel="nofollow noreferrer">https://developer.android.com/ndk/guides/android_mk.html</a>, I wrote this simple Android.mk file:</p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)
  include $(CLEAR_VARS)
  
  LOCAL_MODULE := myModule
  LOCAL_CFLAGS += -I /path/to/OpenCV/main/dir
  LOCAL_LDLIBS := -lopencv_core
  LOCAL_SRC_FILES := bar.cpp
  
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  
  <p>In bar.cpp, I have:</p>
  
  <pre><code>#include &lt;opencv2/core/core.hpp&gt;
  </code></pre>
  
  <p>Just for checking that the compiler can found the sources. When I try to build my C++/OpenCV native code using ndk-build, I get:</p>
  
  <pre><code>non-system libraries in linker flags: -lopencv_core
  Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the current module
  </code></pre>
  
  <p>I tryed to use LOCAL_STATIC_LIBRARIES and LOCAL_SHARED_LIBRARIES, but no succed. Any ideas?</p>
  
  <hr>
  
  <p>P.S.:</p>
  
  <p>It's important to say that I compiled a simple Hello world using NDK (wthout including any OpenCV header) following this example <a href="https://gist.github.com/gnuanu/252fd406f48f7da2c1c7" rel="nofollow noreferrer">https://gist.github.com/gnuanu/252fd406f48f7da2c1c7</a>.</p>
  
  <p>There is a post here <a href="https://stackoverflow.com/questions/14559034/android-mk-how-to-include-ffmpeg-and-opencv">Android.mk: how to include ffmpeg and Opencv</a>, but it has not answers and I can't solve with the info...</p>