Box2d.h 'is not found'


#1

Hi,
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!
Cheers.


#2

Try this one:

#include "Box2D/Box2D.h"

PS: notice the quotes instead of angle brackets.


#3

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?


#4

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/

#5

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:

$(TARGET): $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST)
‘at’mkdir ~~p $
$$ $ $~~o $’at’ $(SHAREDLIBS) $(STATICLIBS)

$(OBJ_DIR)/.o: .cpp $(CORE_MAKEFILE_LIST)
‘at’mkdir ~~p $
$$ $ $ $ $~~c $< o $’at’
$/.o: …/.cpp $
’at’mkdir
p $(’at’D)
$(LOG_CXX)$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) ~~c $<~~o $’at’

*‘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!


#6

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