有两个库扩展了 EAGLview,我想同时使用它们。如何?
openFrameworks 和 cocos2d 两者都有 EAGLview.h
的包装器,当然您不能同时使用两者。只需将两个库(libcocos2d.a
和 libofxiPhone_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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试包含
cocos2d.h
标头,其中EAGLview.h
包含在原始 openFrameworks 代码(即ofMain.h
)中,反之亦然。Try to include the
cocos2d.h
header whereEAGLview.h
is included in the original openFrameworks code (i.e.ofMain.h
), or vice versa.