Port iphone cocos2d-x game to android

Port iphone cocos2d-x game to android
0.0 0


Hi all,

I am trying to port an iphone cocos2d-x game to android. But I got a few issues.

  1. When I try to run the build_native.sh, the compiler seems not support the try…catch… block in the cpp source file. But it can compile when I set the APP_STL to gnustl_static in the Application.mk. But when I change to this, the complier stops due to some c function such as “strcmp” hasn’t declare. (something about exception support in android ndk can be found here, http://stackoverflow.com/questions/4663291/android-ndk-r5-and-support-of-c-exception)

  2. When I remove the try…catch… block in the cpp source code and use the APP_STL := stlport_static option. The compiler stops due to “isdigit()” hasn’t declared in the scope. I found that the “isdigit()” function is declared in the /usr/include/ in the xcode reference. How can I let the compiler to search the /usr/include/ directory?

Thank you!


Did you include the corresponding hearder files?
You should include to use isdigit() and <string.h> to use strcmp.


Thank you! Minggo!


You had better not to use try…catch, I’m not sure if it’s supported on all platforms.


Yes, a thread on Android group(http://groups.google.com/group/android-ndk/browse_thread/thread/89db67ed1fbf6450?pli=1) said not to use try…catch.
Thank you for your reply!