I create an empty project with 3.17, and add box2D include path in setting like this:
but I still can not find the correct header file path in xcode:
I create an empty project with 3.17, and add box2D include path in setting like this:
v3.16 box2d
…\external\Box2D\Dynamics\b2Island.cpp
......
// Solve position constraints
timer.Reset();
bool positionSolved = false;
for (int32 i = 0; i < step.positionIterations; ++i)
{
bool contactsOkay = contactSolver.SolvePositionConstraints();
bool jointsOkay = true;
for (int32 j = 0; j < m_jointCount; ++j)
{
bool jointOkay = m_joints[i]->SolvePositionConstraints(solverData); // here! line 317
jointsOkay = jointsOkay && jointOkay;
}
................
line 317 => bool jointOkay = m_joints[ j ]->SolvePositionConstraints(solverData);
change i to j, it will be fine,I think.
Hi,
Did someone solve this issue?
I’ve the same problem. include <Box2d/Box2d.h>
not work in 3.17.
I included box2d .a file in Build Phrases but i continue with the problem…
You having same issue for both iOS and Android?
For the moment I’m trying to compile 3.17 only in iOS. But when I can compile it on iOS, I’ll try on Android
It would be really great if some cocos2d-x developer explained how to do this.
Adding the search path mentioned above worked for us
Thanks @vkreal2
I included $(PROJECT_DIR)/../cocos2d/external/Box2D/include
in Build Settings > Header Search Paths and now it works.
Thank you! It works!
I’m now experiencing this issue as well with version 3.17 and it seems that the Box2d headers were removed from the /external/ folder. The only Box2d file I can find in the cocos project is /Frameworks/libbox2d.a. So the previous suggestion to add a search path to a header which no longer exists cannot work.
Just download Cocos2dx v3.17 from the download section of this website. there is a “/external/Box2D” folder. 100%!
I added two lines in Android.mk
…
LOCAL_C_INCLUDES += $(LOCAL_PATH)/…/…/…/cocos2d/external/Box2D/include
…
LOCAL_WHOLE_STATIC_LIBRARIES := box2d_static
…
it’s the same for xcode projects. add box2d paths to “Header Search Paths” + If you cant find the Box2d folder in your project navigator… you had also to add the folder to your project)
Enable Box2D in your Project:
xcode: CC_ENABLE_BOX2D_INTEGRATION=1 (search for “Preprocessor Macros” under Build Settings)
android: APP_CPPFLAGS += -DCC_ENABLE_BOX2D_INTEGRATION=1 (Application.mk)
In your Code use it like : #include "Box2D/Box2D.h"
it works!
Has anyone included Box2D for a Mac project?
On iOS it works for me:
But when i try to compile in Mac, i’ve the same problem:
#include <Box2D/Box2D.h>
'Box2D/Box2D.h' file not found
It should work for Mac also.
Please check what that include is added for Mac project settings.
Mac project settings?
Where?
Select target Mac and then check project settings
https://static1.squarespace.com/static/50c25455e4b0ef5720704c6b/t/541b040be4b07b5243aff3cc/1411056655739/
Hmm…
In Build Settings > Header Search Paths i added
$(PROJECT_DIR)/../cocos2d/external/Box2D/include
I added it in the scheme MyGame-desktop instead of the scheme MyGame-mobile.
Is that what you’re trying to say?
If yes, it doesn’t work.
I’m using CocoaPods in the project. In Podfile i configured only MyGame-mobile.
But box2d is another thing… (no pods).
Sure. It’s a setting problem in my project… i’m sure.
@dimon4eg you could reproduce my error creating a new cocos project.
In HelloWorld.cpp add this line:
#include <Box2D/Box2D.h>
After that, compile it (in mobile). You will see the error.
Then edit Build Settings > Header Search Paths and add
$(PROJECT_DIR)/../cocos2d/external/Box2D/include
Compile again. It will work.
Now change scheme to MyGame-desktop and compile in your Mac,
You will see the error again.
And… then… how to fix it on desktop…?
EDIT: adding the header search path in MyGame-desktop, clean & re-build, now works in cpp-example but not in my original project…
Do you have a Desktop target? Did you add the Box2D path there too?
yep.
Maybe something with another lib, framework, etc…
Undefined symbols for architecture x86_64:
.
.
.
.
.
...
"_objc_msgSendSuper2", referenced from:
-[GLFWWindowDelegate initWithGlfwWindow:] in libcocos2d Mac.a(cocoa_window.m.o)
-[GLFWContentView initWithGlfwWindow:] in libcocos2d Mac.a(cocoa_window.m.o)
-[GLFWContentView dealloc] in libcocos2d Mac.a(cocoa_window.m.o)
-[GLFWContentView updateTrackingAreas] in libcocos2d Mac.a(cocoa_window.m.o)
-[GLFWApplication sendEvent:] in libcocos2d Mac.a(cocoa_window.m.o)
-[NSTimerWrapper initWithTimeInterval:callback:] in libcocos2d Mac.a(AudioCache.o)
-[NSTimerWrapper dealloc] in libcocos2d Mac.a(AudioCache.o)
...
"_objc_msgSend_stret", referenced from:
-[GLFWWindowDelegate windowDidResize:] in libcocos2d Mac.a(cocoa_window.m.o)
-[GLFWWindowDelegate windowDidMove:] in libcocos2d Mac.a(cocoa_window.m.o)
__glfwPlatformGetWindowPos in libcocos2d Mac.a(cocoa_window.m.o)
-[GLFWWindowDelegate windowDidBecomeKey:] in libcocos2d Mac.a(cocoa_window.m.o)
__glfwPlatformSetCursorMode in libcocos2d Mac.a(cocoa_window.m.o)
-[GLFWContentView mouseMoved:] in libcocos2d Mac.a(cocoa_window.m.o)
-[GLFWContentView viewDidChangeBackingProperties] in libcocos2d Mac.a(cocoa_window.m.o)
...
"_uncompress", referenced from:
cocos2d::ZipUtils::inflateCCZBuffer(unsigned char const*, long, unsigned char**) in libcocos2d Mac.a(ZipUtils.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)