• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps cnnot build a simple app

mariusc

Lurker
Hi,
I am trying to build a simple C++ app and insert it in android package.
Here are the steps I did:

1. made a new folder in android/external/myapp
2. this folder has one cpp file myapp.cpp having following code:
Code:
 class Hello
{
  public: 
   Hello(){printf("hello");}
   ~Hello(){}
}  ;

int main(argv, argc[])
{
    Hello* h = new Hello();
    delete h;
}
and Android mk
Code:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES :=   myapp.cpp    
LOCAL_C_INCLUDES := 
LOCAL_SHARED_LIBRARIES :=  libstdc++ #libutils -libcutils
                                
LOCAL_LDLIBS += $(EXTRA_LDLIBS)
LOCAL_MODULE := myapp
include $(BUILD_EXECUTABLE)
Then I add my app to main.mk @ /android/build.code/main.nk right after the

Code:
external/zlib \
external/myapp \   # < - here
When I build i get unresolved externals

Code:
undefined reference to `__cxa_end_cleanup' in function '~Hello'
(.ARM.extab.text._ZN11HelloAtMyAppcpp+0x0): undefined reference to `__gxx_personality_v0'
Thank you.
 
Solution for Build error:

1. error: error:
undefined reference to `__cxa_end_cleanup' undefined reference to
`__cxa_end_cleanup '
undefined reference to `__gxx_personality_v0' undefined reference to
`__gxx_personality_v0 '
Solution: Solution:
Add compile flags -fno-exceptions Add compile flags-fno-exceptions
2. error: error:
undefined reference to 'vtable for __cxxabiv1::__class_type_info'
undefined reference to 'vtable for __cxxabiv1:: __class_type_info'
undefined reference to 'vtable for __cxxabiv1::__si_class_type_info'
undefined reference to 'vtable for __cxxabiv1:: __si_class_type_info'
Solution: Solution:
Add compile flags -fno-rtti Add compile flags-fno-rtti
 
Back
Top Bottom