ahoura
ahoura

Reputation: 689

Compile errors when including GameLayer.h in Cocos2D project with Box2D

so i have the following code in a file called mainMenu:

[[CCDirector sharedDirector] runWithScene:[GameLayer scene]];

and I have #import "GameLayer.h". GameLayer has cocos2d, box2d, GLES-Render included in the .h header file.

so whenever I include GameLayer in the mainMenu file (.m) and try to build the app, it fails returning around 360 errors all about b2d (b2settings, b2math etc). anyone has any idea what I am doing wrong??

NOTE the mainMenu code works perfectly fine without including the GameLayer, and so does GameLayer without mainMenu!

Upvotes: 0

Views: 115

Answers (1)

jrtc27
jrtc27

Reputation: 8526

Change Main Menu's extension to .mm. This makes it an Objective-C++ file, which is needed, because box2d is in C++.

Upvotes: 2

Related Questions