Box2d.h 'is not found'


I have my project working in Android. But It doesn’t compile for Linux. The reason is that when I write ‘#include <Box2D/Box2D.h>’ the compiler says that this file doesn’t exist.

I guess I have to add something in the Makefile, but I don’t know what.

Thank you in advance!


Try this one:

#include "Box2D/Box2D.h"

PS: notice the quotes instead of angle brackets.


Thank you for posting.

But the result is the same. The compiler gives me the same Error :confused: the file doesn’t exist.

In my Makefile there are no reference to box2d. Maybe the problems have to do with that. In your Makefile there are any reference?


I’m using Windows and I’m not familiar with makefiles. Sorry.
Have you included ‘external’ directory? Something like as follows:

INCLUDES += -I$(COCOS_ROOT)/external/


Thank you!
Adding this I solved part of the problem. Now there are no error with the include.

The error now comes from the use of box2d. For every operation I use the compiler says that this object (b2World for instance) doesn’t have the operation (step(float, int, int) for instance).

I think that the problem is that libbox2d.a is not included in the executable. I don’t know why :confused:

The executable is generate from:

‘at’mkdir ~~p $
$$ $ $~~o $’at’ $(SHAREDLIBS) $(STATICLIBS)

‘at’mkdir ~~p $
$$ $ $ $ $~~c $< o $’at’
$/.o: …/.cpp $
p $(’at’D)

*‘at’ means the symbol @, I cannot use it.

And the library libbox2d.a is not in my project folder. It’s in cocos2dx-2.2./lib/linux/debug/

:confused: This is very weird. Can someone help me?

Thank you!


Have you tried using ‘cocos2d-x/samples/Cpp/TestCpp/proj.linux/Makefile’ as a reference?