Two libraries extend EAGLview and I want to use them both. How?
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 ea开发者_JAVA技巧sy 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?
Try to include the cocos2d.h
header where EAGLview.h
is included in the original openFrameworks code (i.e. ofMain.h
), or vice versa.
精彩评论