有两个库扩展了 EAGLview,我想同时使用它们。如何?

发布于 2024-11-30 12:51:25 字数 1254 浏览 2 评论 0原文

openFrameworkscocos2d 两者都有 EAGLview.h 的包装器,当然您不能同时使用两者。只需将两个库(libcocos2d.alibofxiPhone_iphoneos_Release.a)添加到我的项目中就会出现链接器错误:

ld: duplicate symbol _OBJC_METACLASS_$_ES1Renderer in /Developer/of_007_iphone/apps/cwi007/iTicTacToe/libofxiPhone_iphoneos_Release.a(ES1Renderer.o) and /Developer/of_007_iphone/apps/cwi007/iTicTacToe/libs/libcocos2d.a(ES1Renderer.o) for architecture armv7
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2 failed with exit code 1

我正在 openFrameworks< 中编写程序的核心< /strong> 因为它很简单并且是 C++。我想用 cocos2d 添加 UI、过渡、菜单等,因为它也很简单,而且看起来很漂亮。

我尝试

#define __OPENFRAMEWORKS__

在一个 .h 文件中尝试,然后将另一个文件包装起来,

#ifndef __OPENFRAMEWORKS__
#endif

认为我可以使用 cocos2d 添加的额外位来“增强”openFrameworks 中的 .h,但随后 openFrameworks不会构建,因为它不再有 EAGLview 的定义。

是否存在使用两个这样的库的最佳实践,这两个库都利用相同的低级功能(在本例中为 CoreAnimation)?我可以编写自己的类来继承它们吗?有没有办法从我的项目中删除 .h 文件之一?

openFrameworks and cocos2d both have a wrapper for EAGLview.h, and of course you can't just use both. Just adding both libraries (libcocos2d.a and libofxiPhone_iphoneos_Release.a) to my project gives a linker error:

ld: duplicate symbol _OBJC_METACLASS_$_ES1Renderer in /Developer/of_007_iphone/apps/cwi007/iTicTacToe/libofxiPhone_iphoneos_Release.a(ES1Renderer.o) and /Developer/of_007_iphone/apps/cwi007/iTicTacToe/libs/libcocos2d.a(ES1Renderer.o) for architecture armv7
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2 failed with exit code 1

I'm writing the core of my program in openFrameworks because it's easy and C++. I want to put a UI, transitions, menus etc. in with cocos2d because it's also easy and looks nice.

I tried

#define __OPENFRAMEWORKS__

in one .h file, and wrapping the other in

#ifndef __OPENFRAMEWORKS__
#endif

figuring I could "augment" the .h in openFrameworks with the extra bits added in by cocos2d, but then openFrameworks wouldn't build because it no longer had a definition for EAGLview.

Is there a best practice for working with two libraries like this that both tap into the same low-level functionality, in this case CoreAnimation? Can I write my own class that inherits from them both? Is there a way to excise one of the .h files from my project?

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

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

发布评论

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

评论(1

深白境迁sunset 2024-12-07 12:51:25

尝试包含 cocos2d.h 标头,其中 EAGLview.h 包含在原始 openFrameworks 代码(即 ofMain.h)中,反之亦然。

Try to include the cocos2d.h header where EAGLview.h is included in the original openFrameworks code (i.e. ofMain.h), or vice versa.

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