1

I'm developing game on cocos2d-x with C++. I developed whole code in xCode. compiled, run in iphone and ipad, run as expected.

But when compiling code for android in windows 7 OS, using Cygwin (64-bit)..I encounterd following code..

$ ./build_native.sh
NDK_ROOT = D:\android-ndk-r9
COCOS2DX_ROOT = /cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android/../../..
APP_ROOT = /cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android/..
APP_ANDROID_ROOT = /cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android
Using prebuilt externals

make: Entering directory '/cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android'
Android NDK: WARNING:/cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android/../../../cocos2dx/Android.mk:cocos2dx_static: LOCAL_LDLIBS is always ignored for static libraries
Compile++ thumb  : cocos2dcpp_shared <= AppDelegate.cpp

Compile++ thumb  : cocos2dcpp_shared <= PlayerSelection.cpp

jni/../../Classes/PlayerSelection.cpp: In member function 'void PlayerSelection::update()':
jni/../../Classes/PlayerSelection.cpp:1511:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

Compile++ thumb  : cocos2dcpp_shared <= GameScene.cpp
C:\cygwin64\tmp\ccdF8Sjo.s: Assembler messages:
C:\cygwin64\tmp\ccdF8Sjo.s:12180: Error: branch out of range
/cygdrive/d/android-ndk-r9/build/core/build-binary.mk:348: recipe for target 'obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/GameScene.o' failed
make: *** [obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/GameScene.o] Error 1
make: Leaving directory '/cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android'

In the Above command-line output the problem is:

Compile++ thumb  : cocos2dcpp_shared <= GameScene.cpp
C:\cygwin64\tmp\ccdF8Sjo.s: Assembler messages:
C:\cygwin64\tmp\ccdF8Sjo.s:12180: Error: branch out of range

I tried Following links:

Why does branching occur in assembly code while comparing for a number to be in range?

https://in.answers.yahoo.com/question/index?qid=20100603163224AAAGX7J

branch out of range compile error

None of above references were helpfull that I could compile code.

Community
  • 1
  • 1
  • Post the code in GameScene.cpp - in particular anything related to cocos2dcpp_shared if that name is referenced by the code as an actual namespace, class or method. Perhaps "348" as mentioned in the followup line indicates the offending line number in GameScene.cpp although it could refer to the line in the .mk file where the error was caught. – CodeSmile May 07 '14 at 08:07
  • https://drive.google.com/file/d/0B4pIZPIFctmnQTBySFZEMFR5YU0/edit?usp=sharing – user2082133 May 09 '14 at 05:07
  • I know that it is HUGE amount of code for anyone to check this type of BUG...But if anyone could give a direction OR Just a tips OR a few experiences,so that I could check the code by myself..? – user2082133 May 12 '14 at 07:16

1 Answers1

1

After battling with my code by checking each function ONE by ONE, I found the problem was lying in nested switch case, if anyone happen to hit this problem this could be it.. And thank you LearnCocos2D for Your interest.