HomeHome  CalendarCalendar  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log inLog in  

Share | 
 

 Compiling ERRORS about '__cxa_bad_cast' on Android using Irrlicht Render Engine

View previous topic View next topic Go down 
AuthorMessage
qidaozhilong2



Messages : 11
Date d'inscription : 2012-03-31

PostSubject: Compiling ERRORS about '__cxa_bad_cast' on Android using Irrlicht Render Engine   Sat Mar 31, 2012 1:36 pm

Hi, everyone.

I found this interesting particle system on irrlicht forum.
So i download "SPARK-1.5.5_SDK" and extract on my Android Eclipse Document, then add some sentences to Android.mk.
But when i compiled this particle part with irrlicht, some errors occur.
Like
"...
...SPK_System.cpp:62: undefined reference to '__cxa_bad_cast'
...
...SPK_Emitter.cpp:50: undefined reference to '__cxa_bad_cast'
...
...SPK_Modifier.cpp:51: undefined reference to '__cxa_bad_cast'
...
...SPK_Group.cpp:125: undefined reference to '__cxa_bad_cast'
...
...SPK_NormalEmitter.cpp:42: undefined reference to '__cxa_bad_cast'
"

Before that, i have tested other 3rd part(irrAI, irrBullet) on Irrlicht engine on Android, the renderer output is OK.
My only Changes on source code:
As renderer used irrlicht, so "SPK_GL_All.cpp", "SPK_SFML_All.cpp" are not included in $(libirrParticle_la_SOURCES)

By the way, i found all the compiling errors are "dynamic_cast operator" ERROR.

Please Help me.Thank you.
(Sorry, English is not my native language, maybe some expression is not good or correct.)

【Android.mk】:
LOCAL_PATH := $(call my-dir)
LOCAL_IRRPARTICLE_INCLUDES := \
$(LOCAL_PATH)/irrlicht_3rd/irrParticle/include/Core \
$(LOCAL_PATH)/irrlicht_3rd/irrParticle/include/Extensions/Emitters \
$(LOCAL_PATH)/irrlicht_3rd/irrParticle/include/Extensions/Modifiers \
$(LOCAL_PATH)/irrlicht_3rd/irrParticle/include/Extensions/Renderers \
$(LOCAL_PATH)/irrlicht_3rd/irrParticle/include/Extensions/Zones \
$(LOCAL_PATH)/irrlicht_3rd/irrParticle/include/RenderingAPIs/Irrlicht \
$(LOCAL_PATH)/irrlicht_3rd/irrParticle/include

libirrParticle_la_SOURCES := \
irrlicht_3rd/irrParticle/source/SPK_All.cpp \
irrlicht_3rd/irrParticle/source/SPK_IRR_ALL.cpp

...

########################## Five Module:IrrParticle ##########################
include $(CLEAR_VARS)
LOCAL_MODULE := irrlichtParticle
LOCAL_C_INCLUDES := $(LOCAL_IRRLICHT_INCLUDES) $(LOCAL_IRRPARTICLE_INCLUDES)
LOCAL_SRC_FILES := $(libirrParticle_la_SOURCES)
LOCAL_SHARED_LIBRARIES := libirrlicht
LOCAL_ARM_MODE := arm
LOCAL_CFLAGS := $(LOCAL_C_INCLUDES:%=-I%) -O3 -DANDROID_NDK -DDISABLE_IMPORTGL
LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog -lGLESv2
include $(BUILD_SHARED_LIBRARY)
#####################################################################

...

########################## test Module3:IrrParticle ##########################
include $(CLEAR_VARS)
LOCAL_MODULE := irrParticleexample
LOCAL_C_INCLUDES := $(LOCAL_IRRLICHT_INCLUDES) $(LOCAL_IRRPARTICLE_INCLUDES) $(LOCAL_IRRPARTICLE_EXAMPLES_INCLUDES)
LOCAL_SRC_FILES := $(libirrParticle_examples_SOURCES)
LOCAL_SHARED_LIBRARIES := libirrlicht libirrlichtParticle
LOCAL_ARM_MODE := arm
LOCAL_CFLAGS := $(LOCAL_C_INCLUDES:%=-I%) -O3 -DANDROID_NDK -DDISABLE_IMPORTGL
LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog -lGLESv2
include $(BUILD_SHARED_LIBRARY)
#####################################################################
Back to top Go down
View user profile
Darktib
Committer


Messages : 389
Date d'inscription : 2009-07-20
Localisation : A coté de Paris

PostSubject: Re: Compiling ERRORS about '__cxa_bad_cast' on Android using Irrlicht Render Engine   Sat Mar 31, 2012 2:02 pm

Which compiler do you use ?
Normally, dynamic_cast should compile fine, and '__cxa_bad_cast' is a compiler defined function (because of the double underscore)

_________________
Back to top Go down
View user profile
qidaozhilong2



Messages : 11
Date d'inscription : 2012-03-31

PostSubject: Re: Compiling ERRORS about '__cxa_bad_cast' on Android using Irrlicht Render Engine   Sat Mar 31, 2012 2:30 pm

Android NDK compiler
Command:
$NDK/ndk-build

Actually, its "arm-linux-androideabi-4.4.3"

Back to top Go down
View user profile
Darktib
Committer


Messages : 389
Date d'inscription : 2009-07-20
Localisation : A coté de Paris

PostSubject: Re: Compiling ERRORS about '__cxa_bad_cast' on Android using Irrlicht Render Engine   Sun Apr 01, 2012 5:13 am

Found that Android NDK Compiler is a modified GCC.
With plain gcc it compiles (was tested on Linux and Windows), but here it seems that dynamic_cast of references is not supported by the compiler (dynamic_cast<const T*> works).

Change the dynamic_cast<const T&> to dynamic_cast<const T*>. Do not forget to change the code that follow the dynamic_cast to work with a pointer and not a reference!

PS: why did you call SPARK 'IrrlichtParticle' ?

_________________
Back to top Go down
View user profile
qidaozhilong2



Messages : 11
Date d'inscription : 2012-03-31

PostSubject: Re: Compiling ERRORS about '__cxa_bad_cast' on Android using Irrlicht Render Engine   Sun Apr 01, 2012 5:46 am

Darktib,

Hi, thanks for your apply.
I've found some useful informations from GOOGLE.
Now, compiled is OK, some changes is following:

Application.mk(before)
"
STLPORT_FORCE_REBUILD := true
APP_STL := stlport_static
"

Application.mk(after)
"
STLPORT_FORCE_REBUILD := true
APP_STL := gnustl_static
LOCAL_CPPFLAGS := -frtti
"

BTW, why did you call SPARK 'IrrlichtParticle' ?
Just a name, of course can be 'IrrlichtSPARK'.
Back to top Go down
View user profile
qidaozhilong2



Messages : 11
Date d'inscription : 2012-03-31

PostSubject: Re: Compiling ERRORS about '__cxa_bad_cast' on Android using Irrlicht Render Engine   Sun Apr 01, 2012 11:34 am

SPARK effort with irrlicht on my Android phone.
Too amazing.

Darktib, good job. But only 2 demos using irrlicht. Have you any plan on port other demos on irrlicht renderer?

Back to top Go down
View user profile
Darktib
Committer


Messages : 389
Date d'inscription : 2009-07-20
Localisation : A coté de Paris

PostSubject: Re: Compiling ERRORS about '__cxa_bad_cast' on Android using Irrlicht Render Engine   Sun Apr 01, 2012 12:04 pm

That's look really cool! Good job for finding the solution!

For the moment I'm working on SPARK 2.0 with Juff, maybe we'll port some demos to Irrlicht (but I don't think all, because demos have to show OpenGL an SFML too; you can still adapt the SPARK logic part, that's not really hard Wink )

_________________
Back to top Go down
View user profile
qidaozhilong2



Messages : 11
Date d'inscription : 2012-03-31

PostSubject: Re: Compiling ERRORS about '__cxa_bad_cast' on Android using Irrlicht Render Engine   Sun Apr 01, 2012 12:11 pm

OK, i will spend some time on the I/Fs between IRRLICHT and SPARK.
I will try to port other demos on Irrlicht.

ps:This project is a GREAT one.
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: Compiling ERRORS about '__cxa_bad_cast' on Android using Irrlicht Render Engine   Today at 3:43 am

Back to top Go down
 
Compiling ERRORS about '__cxa_bad_cast' on Android using Irrlicht Render Engine
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Trulia's Android Tablet Sweepstakes
» Nih aplikasi edit foto dari android yang ngga kalah ama photoshop
» Golden Amazo Vs Super Android 17
» Installing Android/ADB/fastboot Drivers on Windows 10 (Disable Driver Verification)
» Selenium RC; Permission denied on session.([error] Element not found ")

Permissions in this forum:You cannot reply to topics in this forum
 :: English Forum :: Questions (en)-
Jump to: