title: Android C++ build error '__cxa_begin_catch'
body: <p>Recently, I work with Android SOURCE of 4.04, I want to add my own library into external directory.</p>
  
  <p>I face a problem:
  when my C++ code use "C++ exception function", It builds fail.</p>
  
  <p>I write a simple c++ test code, It also fail. </p>
  
  <p>=========THE LOG of building ERROR:</p>
  
  <pre><code>test.cpp:14: undefined reference to `__cxa_begin_catch'
  test.cpp:14: undefined reference to `__cxa_end_catch'
  out/target/product/bcm7231/obj/EXECUTABLES/test_intermediates/test.o:(.data.rel.ro._ZTISt9exception[_ZTISt9exception]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
  out/target/product/bcm7231/obj/EXECUTABLES/test_intermediates/test.o:(.data.DW.ref.__gxx_personality_v0[DW.ref.__gxx_personality_v0]+0x0): undefined reference to `__gxx_personality_v0'
  </code></pre>
  
  <p>=============The Simple C++ test is As follow:</p>
  
  <pre><code>//Test.cpp
  #include &lt;exception&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  
  int main(int argc, char *argv[])
  {
      cout &lt;&lt; "hello world" &lt;&lt; endl;
      // Test c++ exception
      int* myarray = NULL;
      try 
      {   
          myarray= new int[1024 * 128];
      }   
      catch (exception&amp; e)
      {   
          cout &lt;&lt; "Standard exception: " &lt;&lt; e.what() &lt;&lt; endl;
      }
  
      delete[] myarray;
  
      return 0;
  }
  </code></pre>
  
  <p>============= The Android.mk is as follow:</p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)
  include $(CLEAR_VARS)
  
  LOCAL_SRC_FILES := test.cpp
  LOCAL_C_INCLUDES := external/stlport/stlport \
                      bionic \
                      bionic/libstdc++
  LOCAL_MODULE := test
  LOCAL_MODULE_TAGS := optional
  
  LOCAL_CPP_FEATURES += exceptions
  LOCAL_CPPFLAGS :=  -fexceptions
  LOCAL_SHARED_LIBRARIES := libstlport
  
  include $(BUILD_EXECUTABLE)
  </code></pre>
  
  <p><strong>Anyone know it？
  I'm confusing about it now.</strong></p>