title: Android Studio with NDK : link error : undefined reference to 'stderr'
body: <p>I've compiled OpenCV static libraries targeting android armeabi-v7a.</p>
  
  <p>Now I'm trying to link my native C++ code with those libraries through a CMakeLists.txt file in Android Studio but this fails with this weird error :</p>
  
  <pre><code>~/opencv/modules/videoio/src/container_avi.cpp:0: error: undefined reference to 'stderr'
  </code></pre>
  
  <p>This code comes from the libopencv_videoio.a </p>
  
  <p>The interresting part of the CMakeLists.txt file is this</p>
  
  <pre><code># linking with static libraries
  target_link_libraries(native-lib
       dnn ml objdetect shape stitching superres videostab calib3d features2d highgui videoio imgcodecs video photo imgproc flann core
  )
  </code></pre>
  
  <p>Isn't it supposed to find standard libraries automatically ?</p>
  
  <p>EDIT 1:
  Following is my Application.mk</p>
  
  <pre><code>...
  NDK_TOOLCHAIN_VERSION := clang
  APP_PLATFORM := android-21
  APP_STL := c++_shared
  ...
  </code></pre>
  
  <p>NDK version taken from Changelog.md : r17b</p>
  
  <p>EDIT 2:</p>
  
  <p>As Dan suggested, I've added </p>
  
  <blockquote>
    <p>"-DANDROID_PLATFORM=android-24"</p>
  </blockquote>
  
  <p>to the cmake arguments</p>