Forum > C++ > IOS C++ Code Not Working In Android

IOS C++ Code Not Working In Android

By vishalhsoni Posted 2012-08-04 12:13 Comments 3
vishalhsoni
  • Posts: 26

I wanted to develop cross platform application to run on IPhone and Android. I wrote the code for IPhone and its working properly. When I used Classes folder .cpp and .h in my Android application it was giving errors in Destructor calls, exception handling etc.. Is it because IOS C++ compiler/builder works different than Android builder/compiler. BTW i am developing my Android application using Windows 7 using Cygwin as a builder/compiler. What can be the problem?

Other issue I got in Android was that when leaving and re-entering the IPhone application the scene was pausing perfect. But in Android the scene was getting messed up while doing same steps.

walzer
  • Posts: 1735
  • Location: Xiamen, China

#1 RE: 2012-08-04 16:21

  1. For compilation error, please paste the error log here. Some c++ syntax is supported by llvm, but not gcc, for example, anonymous structure.
  2. Which version of cocos2d-x are you using? The difference is that, ios system would do everything at background-foreground switching, but android would not. CCTextureCache::reloadAllTextures() is written to deal with reloading textures at back->foreground switch on android. Please check you have enough memory on your android device, or track into this function and make sure all textures are reloaded successfully.

Less is More. Keep Focus.

walzer
  • Posts: 1735
  • Location: Xiamen, China

#2 RE: 2012-08-04 16:38

More details please.
* Android SDK version
* The name of Android device

Less is More. Keep Focus.

vishalhsoni
  • Posts: 26

#3 RE: 2012-08-06 05:49

Hi, thanks for the reply.

  1. Compilation error : Suppose I have a class hierarchy C inherited from B and B inherited form A (C > B> A). Now when calling destructor, I call this statement B::~B ();* in my C class and call *A::~A(); in my B class. When I build my project I get the following error in my B class:

**Multiple markers at this line

  • candidate is:
  • no matching function for call to ’B::~B ()'*

Another compilation error I am getting is while using *try catch* and that is following:

    \*exception handling disabled, use -fexceptions to enable\*

while writing catch statements as below:

    \*catch (std::exception e)**
  1. I am using cocos2d-2.0-rc2-x-2.0.1 as Cocos2D-X version from [[http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Download]].

Where to write this CCTextureCache::reloadAllTextures*
3. Android SDK Version is
Android 2.2**.
4. Device name is**HTC One V*.

Loggin to reply

Copyright © 2010 - 2013 Cocos2d-x.orgClustrmaps