Cassert file not found, but I'm using Box2d template

I use cocos2d template with Box2d, but when I import Box2d.h into my project, it gives me an error cassert fiel not found I have version cocos2d version 2.0 please help me

+7
source share
4 answers

Make sure all project source code files have a .mm and not .m file extension. Or, set each .m file type to Objective-C ++.

+23
source

change the file extension .mm thats it

+1
source

Changing the extension in xcode 4 will not work. Instead, go to the settings (tab) and change the standard C ++ library to libC ++ (LLVM ...) from the default compiler.

If you build it now, you will receive an error message stating that the application is not compatible with iOS 5 or later. So, go to the summary (tab) and change the deployment target to 5.0. Now it should work successfully.

0
source

This is how I fixed the problem. Clearing and re-creating the project was apparently not a good idea for me.

There are several answers on the Internet on this problem, but they did not help me solve this problem. One is on SO in

cassert file not found, but I am using Box2d template and the other is on cocos2d-iphone forum,

http://www.cocos2d-iphone.org/forums/topic/cannot-include-box2d-cassert-file-not-found-despite-every-file-being-mm/

The combination of the two sentences worked for me -

  • Rename all YOURS (not cocos2d or box2d files, only your project files) from .m to .mm
  • Make sure that on each of the files in the right pane the "Type" parameter is set to "Default - C ++ Source Object"

There was another problem for me, maybe not a problem for you, I used the following signature for CCLabelTTF

CCLabelTTF *title = [CCLabelTTF labelWithString:@"Hello" dimensions:CGSizeMake(720.0f, 880.0f) alignment:UITextAlignmentLeft fontName:@"Arial" fontSize:34]; 

This is deprecated and caused errors everywhere. Now I am using the following slightly modified version and bug fixes -

 CCLabelTTF *title = [CCLabelTTF labelWithString:@"Hello" dimensions:CGSizeMake(720.0f, 880.0f) hAlignment:kCCTextAlignmentRight fontName:@"Arial" fontSize:34]; 

My latest record of this fix is โ€‹โ€‹at http://indiangamer.com/how-i-fixed-the-cocos2d-box2d-include-file-not-found-error/

0
source

All Articles