我在基于Windows的应用程序中集成了Cocos2d。当我运行我的项目时,我在执行行CC_DIRECTOR_INIT();
后收到崩溃错误是** sharedlibrary ** apply-load-rules all
警告:当前语言与此框架不匹配。
当前语言:auto;目前客观c ****。我从POST找到了错误的含义。但我的问题是如何在我的项目中实现这一点。我是cocos2-d的新手。任何建议表示赞赏。
- (void) applicationDidFinishLaunching:(UIApplication*)application
{
CC_DIRECTOR_INIT();
CCDirector *director = [CCDirector sharedDirector];
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
[director setDisplayFPS:YES];
EAGLView *view = [director openGLView];
[view setMultipleTouchEnabled:YES];
[CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];
[[CCDirector sharedDirector] runWithScene: [Helloworld scene]];
}
这是发生崩溃的屏幕截图...
编辑: 我的控制台输出..
#0 0x0002e60f in -[CCLabelAtlas updateAtlasValues] (self=0x68224c0, _cmd=0xc0be2) at CCLabelAtlas.m:75
#1 0x0002e994 in -[CCLabelAtlas setString:] (self=0x68224c0, _cmd=0x310f12c, newString=0xf3b98) at CCLabelAtlas.m:113
#2 0x0002e49c in -[CCLabelAtlas initWithString:charMapFile:itemWidth:itemHeight:startCharMap:] (self=0x68224c0, _cmd=0xb8d31, theString=0xf3b98, charmapfile=0xf3b88, w=16, h=24, c=46 '.') at CCLabelAtlas.m:50
#3 0x0002e380 in +[CCLabelAtlas labelAtlasWithString:charMapFile:itemWidth:itemHeight:startCharMap:] (self=0xf1ebc, _cmd=0xb6fd5, string=0xf3b98, charmapfile=0xf3b88, w=16, h=24, c=46 '.') at CCLabelAtlas.m:40
#4 0x0001268a in -[CCDirector setGLDefaultValues] (self=0x681c300, _cmd=0xb6b3d) at CCDirector.m:219
#5 0x0001406d in -[CCDirector setOpenGLView:] (self=0x681c300, _cmd=0xb6a18, view=0x681c850) at CCDirector.m:549
#6 0x00002e58 in -[cocowindowAppDelegate applicationDidFinishLaunching:] (self=0x681abe0, _cmd=0xd050a3, application=0x68016f0) at cocowindowAppDelegate.m:32
#7 0x00912ce2 in -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] ()
#8 0x00914d88 in -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] ()
#9 0x0091f617 in -[UIApplication handleEvent:withNewEvent:] ()
#10 0x00917abf in -[UIApplication sendEvent:] ()
#11 0x0091cf2e in _UIApplicationHandleEvent ()
#12 0x02e61992 in PurpleEventCallback ()
#13 0x01403944 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#14 0x01363cf7 in __CFRunLoopDoSource1 ()
#15 0x01360f83 in __CFRunLoopRun ()
#16 0x01360840 in CFRunLoopRunSpecific ()
#17 0x01360761 in CFRunLoopRunInMode ()
#18 0x009147d2 in -[UIApplication _run] ()
#19 0x00920c93 in UIApplicationMain ()
#20 0x00002b39 in main (argc=1, argv=0xbfffeff0) at main.m:14
(gdb)
答案 0 :(得分:1)
EXC_ARITHMETIC
通常意味着你除以零。如果您查看屏幕截图,那么您正在评估:
int row = (a % itemsPerRow) //...
从调试器的输出看,itemsPerRow
在出现这种情况时看起来是0,因此程序崩溃了。尝试初始化此值或设置一些条件代码,如果它是零以阻止它除以零。
警告消息Warning: the current language does not match this frame.
只是GDB对于调试它的语言感到有点困惑。正如你所看到的,它设法在下一行排序。
修改强>
这张海报与您有类似的错误:http://www.cocos2d-iphone.org/forum/topic/8209他的修正是否适用于您?