Various “error: undefined reference to ”

I’m tryng to port an iOS game to Android platform with cocos2dx 2.0.4. The core of the game is written in c++ and we managed to run it on iOS, in fact the game is avaivable on the Apple Store. I’m using NDK r8d and lastest SDK, but I’m encountering a lot of issues when trying to build.

My application.mk is like this:

APP_STL := stlport_shared
APP_CPPFLAGS := ~~frtti
NDK_TOOLCHAIN_VERSION=4.7
Android.mk:
LOCAL_PATH := $
>
include $
>
ifdef STLG
LOCAL_MODULE := stlport_stlg
else
LOCAL_MODULE := stlport
endif
LOCAL_CFLAGS = ~~DANDROID* >~~isystem $/usr/include > LOCAL_MODULE := game_shared
>
LOCAL_MODULE_FILENAME := libgame
>
LOCAL_CPPFLAGS*=~~fexceptions
>
>
LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes
LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes $(LOCAL_PATH)/…/…/…/…/Box2D $(LOCAL_PATH)/…/…/…/…/cocos2dx $(LOCAL_PATH)/…/…/…/…/
>
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static
>
include $(BUILD_SHARED_LIBRARY)
>
$(call import-module,CocosDenshion/android) > $(call import-module,cocos2dx) > $(call import-module,extensions)
>
Here’s the console log (only errors displayed):

/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_alloc.h:158: error: undefined reference to ’std::*node_alloc::*M_allocate‘
make: Leaving directory `/Users/arianna/android/cocos2d-2.0-x-2.0.4/grannnnnnny/proj.android’
/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_alloc.h:161: error: undefined reference to ’std::node_alloc::*M_deallocate‘
/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_string.c:600: error: undefined reference to ’std::*stl_throw_length_error’
/Users/arianna/android/cocos2d-2.0-x-2.0.4/grannnnnnny/proj.android/…/…/cocos2dx/actions/CCActionInterval.cpp:386: error: undefined reference to ’*dynamic_cast’
/Users/arianna/android/cocos2d-2.0-x-2.0.4/grannnnnnny/proj.android/…/…/cocos2dx/actions/CCActionInterval.cpp:1783: error: undefined reference to ‘*dynamic_cast’
/Users/arianna/android/cocos2d-2.0-x-2.0.4/grannnnnnny/proj.android/…/…/cocos2dx/actions/CCActionInterval.cpp:1838: error: undefined reference to ’*dynamic_cast’
/Users/arianna/android/cocos2d-2.0-x-2.0.4/grannnnnnny/proj.android/…/…/cocos2dx/actions/CCActionInterval.cpp:1906: error: undefined reference to ’*dynamic_cast’
/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_vector.c:41: error: undefined reference to ’std::stl_throw_length_error’
/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_vector.c:45: error: undefined reference to ’std::stl_throw_out_of_range(char const
)’
/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_string.c:604: error: undefined reference to ’std::*stl_throw_out_of_range’
>
/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_vector.c:41: error: undefined reference to ’std::*stl_throw_length_error‘
>
./obj/local/armeabi/libcocos2d.a(CCDirector.o):CCDirector.cpp:function typeinfo for cocos2d::CCDirector: error: undefined reference to ’vtable for *cxxabiv1::*vmi_class_type_info’
>
/Users/arianna/android/android-ndk-r8d/sources/cxx-stl/stlport/stlport/stl/_vector.c:41: error: undefined reference to ’std::__stl_throw_length_error’
>
collect2: error: ld returned 1 exit status
>
make:
** [obj/local/armeabi/libgame.so] Error 1
>

Any help much appreciated, thanks…

cocos2d-x now uses gnu stl.
So you need to set the flag APP_STL := gnustl_static in Application.mk.

I tried already, but it’s the same…lots undefined references, not the same, but always unable to compile….

maybe it’s a problem the way I added the game lib into the project.

I’ll explain myself:
I’ve just put all lib that contains the .cpp files into proj.android/Classes folder, and made some customization of the main file…

I followed this tutorial correctly http://www.raywenderlich.com/11283/cocos2d-x-for-ios-and-android-getting-started