如何在 Windows 下为 Code::Blocks/MinGW32 编译 Box2D?
我在互联网上发现了类似的问题,但没有一个对我有帮助。 Code::Blocks 工作区和项目文件包含 DO 生成 .a 文件,我已将它们移至 Codeblocks/MinGW/lib,并将 Box2D 文件夹移至 Codeblocks/MinGW/include 以及 HelloWorld.cpp 示例仍然给我这些错误。
I've found similar questions across the internet, none of which helped me. The Code::Blocks workspace and project files included DO generate .a files, and I've moved them to Codeblocks/MinGW/lib, and I've moved the Box2D folder to Codeblocks/MinGW/include and yet the HelloWorld.cpp example still gives me these errors.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您用来构建 .a 的项目文件缺少一些文件。错误消息中提到的文件是在 v2.1.2 之后从 Box2D 中删除的文件,所以我猜测您正在使用 2.1.2 源代码(或类似版本)以及来自其他来源的项目文件?
无论如何,自己设置这些非常简单。在“管理”面板中,右键单击“引擎”项目,选择“删除文件”,然后单击“确定”以删除所有内容。
现在执行相同操作并选择递归添加文件,选择包含 Box2d.h 文件的文件夹:
单击“确定”几次,就完成了。
就您而言,由于您已经构建了它,所以我希望现在可以,但是对于到达此处想要从头开始设置项目文件的任何人,您还需要指定 Box2D 标头的搜索路径。
为此,请在同一右键单击菜单中选择:属性 ->项目设置选项卡 ->项目的构建选项按钮 ->搜索目录选项卡 ->添加按钮。现在,选择您刚刚在上面选择的文件夹的父文件夹。
Looks like the project files you used to build the .a were missing some files. The file mentioned in the error message is one that was removed from Box2D after v2.1.2, so I'm guessing you are using 2.1.2 source code (or thereabouts) with project files from some other source?
In any case, setting these up yourself is really simple. In the 'Management' panel, right click the 'Engine' project, select Remove files and click OK to remove everything.
Now do the same and select Add files recursively, choose the folder that contains Box2d.h file:
Click OK a few times, and you're done.
In your case, since you had it building already I would expect this to be ok now but for anyone arriving here wanting to setup a project file from scratch, you'll also need to specify the search path for the Box2D headers.
To do this, in the same right-click menu choose: Properties -> Project settings tab -> Project's build options button -> Search directories tab -> Add button. Now choose the parent folder of the one you just chose above.