erincatto / box2d

Box2D is a 2D physics engine for games
https://box2d.org
MIT License
8.05k stars 1.51k forks source link

OSX: Can't find Box2D header file #687

Closed jchavezberkeley closed 2 years ago

jchavezberkeley commented 3 years ago

Hello! I recently installed Box2D using Homebrew on my Mac OSX 11.2.1. I need to use it in a project I am building with cmake and want to open it up in Xcode.

brew install box2d -> installs 2.4.1

I follow the general procedure of making a xcode folder, and running cmake -G Xcode .. in that folder. But my build fails when I try to include Box2D

fatal error: 'Box2D/Box2D.h' file not
      found
#include "Box2D/Box2D.h"

I also tried running with just regular cmake .. and then make -j 8. But nothing.

I saw a very old tutorial with Xcode and Box2D, but that wasn't very helpful now.

Any urgent help on this would be greatly appreciated. Thanks

thegrb93 commented 3 years ago

I think the recent box2d upgrade is the cause. linux and windows configs were updated but not yet osx. Need to update osx projects.

jchavezberkeley commented 3 years ago

Should I go back to a previous version? Thanks

thegrb93 commented 3 years ago

You can check-out one of the earlier release tags, yeah.

1aam2am1 commented 3 years ago

Shouldn't include of library be with <> and not this "" brackets.

jchavezberkeley commented 3 years ago

I'm still having some trouble on this. I tried pulling in the include folder from box2d-2.4.1 or box-2.4.0 and putting it into my Xcode project. While it builds, it still gives me a ld: library not found for -lBox2D error. I also tried to use <> rather than "" but no luck.

FelipeMoleiro commented 3 years ago

It has been a while since you posted your comment, but since the issue is still open I think I might try and help, for others that might have the same problem. I think the problem may be that up until version 2.3.1 the headers were capitalized as Box2D, but in the newer versions they were changed to box2d.h and -lbox2d. Hope this helps.

erincatto commented 2 years ago

Yeah, check your capitalization.