Process Recurrence:
Using Coco2d-x to make a 2048, in the Xcode simulator run and Real machine debugging on the pad is no problem, but in the use of Eclipse debugging packaged Android can run, but after entering the game will be in a random place to flash back, debug mode error:
10-20 11:48:36.413:a/libc (17408): Fatal signal (SIGSEGV) at 0x68d7b0b8 (code=2), Thread 17426 (Thread-7958)
On the internet to find out about the problem of N, including Android version errors and so on, and finally found that the problem is the assignment string caused by the memory overflow, the reason to run on iOS is no problem because iOS allocated more memory than Android,
The error code is as follows:
. hint select;std::string SS;. C std::string ss= "Bland"; Auto Select2=label::createwithsystemfont (Stringutils::format ("%s", Ss.c_str ()), "", 30); This->addchild (SELECT2); Select2->settag (this->select=random);%6; Cclog ("s=%d", select); Switch (this->select) {case 0:ss= "bland"; Break Case 1:ss= "Both worlds"; Break Case 2:ss= "heaven"; Break Case 3:ss= "Smoke four"; Break Case 4:ss= "Zhuang Zhou Dream Butterfly"; Break Case 5:ss= "The past of the red Dust"; Break Default:break; } Auto Lb= (Label *) This->getchildbytag (220); Lb->setstring (ss);
Solution Set Character array
Code
. hint Select;std::string SS; char* selectstr[6]= {"Bland", "smooth and Smooth", "heaven", "Smoke Four", "Zhuang Zhou Dream Butterfly", "Red Dust Past"};. C std::string ss= "Bland"; Auto Select2=label::createwithsystemfont (Stringutils::format ("%s", Ss.c_str ()), "", "("); This->addchild (SELECT2); Select2->settag (this->select=random);%6; Auto lb= (Label *) This->getchildbytag (); Lb->setstring (Selectstr[select]);
This shows that the assignment of a string cannot take the usual "=" to cause a memory overflow problem.
[Cocos2d-x] [APK Package][fatal signal 11][andriod]eclipse compilation Fatal Signal 11 error-All words assigned value to blame