在外部 iOS 项目中使用 Box2D/Cocos2D

发布于 2024-10-14 03:20:02 字数 803 浏览 1 评论 0原文

我已按照本文中的说明进行操作,并且一直在工作使用 Cocos2D 没有太多问题。最近,我尝试包含 Box2D 标头来尝试一些物理操作,如下所示:

#import "Box2D.h"

这导致了很多错误,其中 Box2D.h 文件无法包含其余的头文件:

../cocos2d-iphone-0.99.5/external/Box2d/Box2D/Box2D.h:34:0 ../cocos2d-iphone-0.99.5/external/Box2d/Box2D/Box2D.h:34:37: error: Box2D/Common/b2Settings.h: No such file or directory

这是第一个错误,其余 23 个错误就像但对于 Box2D.h 中的不同标头。

我已经按照本文中的说明将项目/目标添加到当前项目中,因此我的项目当前如下所示:

 alt text

另外,我尝试通过选择项目中的所有 .m 文件并将文件类型设置为 sourcecode.cpp.objcpp 来解决此问题,但我不认为这是问题所在。我确信在用户标头搜索路径构建设置下,会添加存储这些标头的文件夹。如果不是,Cocos2D 也将无法编译。

我做错了什么?

I have followed the instructions as per this article and have been working with Cocos2D without much issues. Recently, I tried including the Box2D headers to try some physics like so:

#import "Box2D.h"

This resulted in a lot of errors where the Box2D.h file could not include the rest of the header files:

../cocos2d-iphone-0.99.5/external/Box2d/Box2D/Box2D.h:34:0 ../cocos2d-iphone-0.99.5/external/Box2d/Box2D/Box2D.h:34:37: error: Box2D/Common/b2Settings.h: No such file or directory

That's the first error and the rest of the 23 are like that, but for the different headers in Box2D.h.

I have already added the projects/targets to the current project as per the instructions in the article, so my project currently looks like this:

alt text

Also, I have attempted to remedy this by selecting all .m files in my project and setting the file type to sourcecode.cpp.objcpp but do not think that this is the issue. I am certain that under the User Header Search Paths build setting, the folders where these headers are stored are added. If it weren't, Cocos2D wouldn't be able to compile either.

What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

来世叙缘 2024-10-21 03:20:02

我不知道这对其他程序员来说是否显而易见,但我通过检查目标设置中的始终搜索用户路径设置来修复此问题。希望它对其他人有帮助。

I don't know if this is immediately obvious to other programmers, but I fixed this by checking the Always Search User Paths setting in the target settings. Hope it helps someone else.

当爱已成负担 2024-10-21 03:20:02

对我来说另一个解决方案是从目录名称中删除空白字符。例如,如果您的项目文件夹

"user/prj 01" 

将其更改为

 "user/prj01".

Another solition for me is removing blank characters from directory names. Forexample if your project folder such as

"user/prj 01" 

change it to

 "user/prj01".
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文