cnnot build a simple app


Last Updated:

  1. mariusc

    mariusc New Member This Topic's Starter

    Joined:
    Oct 13, 2009
    Messages:
    2
    Likes Received:
    0
    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 (Text):
    1.  class Hello
    2. {
    3.   public:
    4.    Hello(){printf("hello");}
    5.    ~Hello(){}
    6. }  ;
    7.  
    8. int main(argv, argc[])
    9. {
    10.     Hello* h = new Hello();
    11.     delete h;
    12. }
    13.  
    14.  
    and Android mk
    Code (Text):
    1. LOCAL_PATH := $(call my-dir)
    2. include $(CLEAR_VARS)
    3. LOCAL_SRC_FILES :=   myapp.cpp    
    4. LOCAL_C_INCLUDES :=
    5. LOCAL_SHARED_LIBRARIES :=  libstdc++ #libutils -libcutils
    6.                                
    7. LOCAL_LDLIBS += $(EXTRA_LDLIBS)
    8. LOCAL_MODULE := myapp
    9. include $(BUILD_EXECUTABLE)
    Then I add my app to main.mk @ /android/build.code/main.nk right after the

    Code (Text):
    1. external/zlib \
    2. external/myapp \   # < - here
    3.  
    When I build i get unresolved externals

    Code (Text):
    1. undefined reference to `__cxa_end_cleanup' in function '~Hello'
    2. (.ARM.extab.text._ZN11HelloAtMyAppcpp+0x0): undefined reference to `__gxx_personality_v0'
    3.  
    Thank you.
     

    Advertisement
  2. serdaraytac

    serdaraytac Member

    Joined:
    Oct 21, 2009
    Messages:
    7
    Likes Received:
    0
    Why do you use C++
    What is your destination ?
     
  3. mariusc

    mariusc New Member This Topic's Starter

    Joined:
    Oct 13, 2009
    Messages:
    2
    Likes Received:
    0
    I manage to get it linked.
    Destination was

    /system/bin/mydaemon


    Thank you.
     
  4. n269

    n269 New Member

    Joined:
    Dec 23, 2009
    Messages:
    1
    Likes Received:
    0
    Hi,

    Could you please post your solution here? I'm running into the same problem.
     
  5. virafz

    virafz New Member

    Joined:
    Sep 16, 2010
    Messages:
    1
    Likes Received:
    0
    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
     

Share This Page

Loading...