title: Undefined reference to Library android NDK
body: <p>I am working with android ndk and I got this error when build my project:</p>
  
  <pre><code>error: undefined reference to 'std::basic_string&lt;char, std::char_traits&lt;char&gt;,         std::allocator&lt;char&gt; &gt;::_Rep::_M_destroy(std::allocator&lt;char&gt; const&amp;)'
  /home/khoa/ndk/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/khoa/Khoa/OpenCV-2.4.9-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(mathfuncs.cpp.o): in function cv::magnitude(cv::_InputArray const&amp;, cv::_InputArray const&amp;, cv::_OutputArray const&amp;):mathfuncs.cpp(.text._ZN2cv9magnitudeERKNS_11_InputArrayES2_RKNS_12_OutputArrayE+0x278): error: undefined reference to 'std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::_Rep::_M_destroy(std::allocator&lt;char&gt; const&amp;)'
  /home/khoa/ndk/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/khoa/Khoa/OpenCV-2.4.9-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_core.a(mathfuncs.cpp.o): in function cv::magnitude(cv::_InputArray const&amp;, cv::_InputArray const&amp;, cv::_OutputArray const&amp;):mathfuncs.cpp(.text._ZN2cv9magnitudeERKNS_11_InputArrayES2_RKNS_12_OutputArrayE+0x2aa): error: undefined reference to 'std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::_Rep::_M_destroy(std::allocator&lt;char&gt; const&amp;)'
  </code></pre>
  
  <p>In Application.mk i have added:</p>
  
  <pre><code>APP_STL := gnustl_static
  APP_STL := -lsupc++
  APP_STL := stlport_static
  APP_CPPFLAGS := -frtti -fexceptions
  APP_ABI := armeabi-v7a
  APP_PLATFORM := android-8
  </code></pre>
  
  <p>This is my Android.mk:</p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)
  include $(CLEAR_VARS)
  OPENCV_LIB_TYPE:=STATIC
  OPENCV_INSTALL_MODULES:=on
  OPENCV_CAMERA_MODULES:=off
  include /home/khoa/Khoa/OpenCV-2.4.9-android-sdk/sdk/native/jni/OpenCV.mk
  LOCAL_C_INCLUDES += ${NDKROOT}/sources/cxx-stl/stlport/stlport
  LOCAL_MODULE := csp
  LOCAL_SRC_FILES := csp.cpp
  LOCAL_LDLIBS +=  -llog -ldl
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  
  <p>How do I resolved this problem? </p>