title: android-ndk gnustl_static exe not working
body: <p>I can't seem to get the following trivial code to compile/link and the problem seems specific to std::wstring and the gnustl_static C++ library. Any help would be appreciated.</p>
  
  <p>main.cpp file:</p>
  
  <pre><code>#include &lt;string&gt;
  int main(void)
  {
      std::wstring wtest(L"Test");
      return 0;
  }
  </code></pre>
  
  <p>Application.mk file:</p>
  
  <pre><code>APP_CFLAGS += -fexceptions
  APP_STL := gnustl_static
  </code></pre>
  
  <p>Android.mk file:</p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)
  include $(CLEAR_VARS)
  LOCAL_MODULE := TestWCharApp
  LOCAL_CFLAGS := -D_GLIBCXX_USE_WCHAR_T
  LOCAL_SRC_FILES := main.cpp
  include $(BUILD_EXECUTABLE)
  </code></pre>
  
  <p>When attempting to link the above application using gnustl_static I get the following error message:</p>
  
  <pre><code>undefined reference to `std::basic_string&lt;wchar_t, std::char_traits&lt;wchar_t&gt;, std::allocator&lt;wchar_t&gt; &gt;::basic_string(wchar_t const*, std::allocator&lt;wchar_t&gt; const&amp;)'
  </code></pre>
  
  <p>If I change APP_STL to stlport_static and define _STLP_HAS_WCHAR_T everything seems to compile/link/run fine. I verify it works by uploading the exe to the emulator and running it via the shell.</p>
  
  <p>I'm going to need to use the gnustl implementation for c++ exception support otherwise I'd go with stlport_shared. Any clues as to why the above sample works for stlport_static but not gnustl_static?</p>