我是Cocos2d和Xcode的新手(以及游戏开发和mac,我是窗口和eclipse用户)。我正在coco2dx主页上programmer guide工作。我克隆了git并尝试运行代码,但我面临着libcocos2d iOS.a的编译错误。我已经设置了库路径(到libcocos2d)和头文件导致" cocos2d.h找不到"错误。但是现在我遇到了链接器错误的问题。我已经google搜索构建架构错误,但没有货物。我当前构建体系结构的构建设置是调试是,不发布,架构设置为标准64位x86_64,有效架构是-armv7,armv7s,i386,x86_64和arm64-有些人可以帮我这个吗?
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_CMMotionManager", referenced from:
objc-class-ref in libcocos2d iOS.a(CCDevice-ios.o)
"_OBJC_CLASS_$_EAGLContext", referenced from:
objc-class-ref in libcocos2d iOS.a(CCDirectorCaller-ios.o)
"_OBJC_CLASS_$_UIApplication", referenced from:
objc-class-ref in libcocos2d iOS.a(CCApplication-ios.o)
objc-class-ref in libcocos2d iOS.a(CCDirectorCaller-ios.o)
objc-class-ref in libcocos2d iOS.a(CCDevice-ios.o)
"_OBJC_CLASS_$_UIColor", referenced from:
objc-class-ref in libcocos2d iOS.a(CCDevice-ios.o)
"_OBJC_CLASS_$_UIDevice", referenced from:
objc-class-ref in libcocos2d iOS.a(CCApplication-ios.o)
objc-class-ref in libcocos2d iOS.a(CCDevice-ios.o)
"_OBJC_CLASS_$_UIFont", referenced from:
objc-class-ref in libcocos2d iOS.a(CCDevice-ios.o)
"_OBJC_CLASS_$_UIImage", referenced from:
objc-class-ref in libcocos2d iOS.a(CCImage-ios.o)
"_OBJC_CLASS_$_UIScreen", referenced from:
objc-class-ref in libcocos2d iOS.a(CCDevice-ios.o)
"_UIApplicationDidBecomeActiveNotification", referenced from:
-[CCDirectorCaller init] in libcocos2d iOS.a(CCDirectorCaller-ios.o)
"_UIApplicationWillResignActiveNotification", referenced from:
-[CCDirectorCaller init] in libcocos2d iOS.a(CCDirectorCaller-ios.o)
"_UIGraphicsPopContext", referenced from:
cocos2d::Device::getTextureDataForText(char const*, cocos2d::FontDefinition const&, cocos2d::Device::TextAlign, int&, int&, bool&) in libcocos2d iOS.a(CCDevice-ios.o)
"_UIGraphicsPushContext", referenced from:
cocos2d::Device::getTextureDataForText(char const*, cocos2d::FontDefinition const&, cocos2d::Device::TextAlign, int&, int&, bool&) in libcocos2d iOS.a(CCDevice-ios.o)
"_UIImageJPEGRepresentation", referenced from:
cocos2d::Image::saveToFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) in libcocos2d iOS.a(CCImage-ios.o)
"_UIImagePNGRepresentation", referenced from:
cocos2d::Image::saveToFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) in libcocos2d iOS.a(CCImage-ios.o)
"AppDelegate::AppDelegate()", referenced from:
_main in main.o
"AppDelegate::~AppDelegate()", referenced from:
_main in main.o
"_glBindVertexArrayOES", referenced from:
cocos2d::GL::bindVAO(unsigned int) in libcocos2d iOS.a(ccGLStateCache.o)
"_glDeleteVertexArraysOES", referenced from:
cocos2d::Renderer::~Renderer() in libcocos2d iOS.a(CCRenderer.o)
cocos2d::MeshCommand::releaseVAO() in libcocos2d iOS.a(CCMeshCommand.o)
cocos2d::TextureAtlas::~TextureAtlas() in libcocos2d iOS.a(CCTextureAtlas.o)
cocos2d::CameraBackgroundSkyBoxBrush::~CameraBackgroundSkyBoxBrush() in libcocos2d iOS.a(CCCameraBackgroundBrush.o)
cocos2d::CameraBackgroundSkyBoxBrush::initBuffer() in libcocos2d iOS.a(CCCameraBackgroundBrush.o)
cocos2d::Physics3DDebugDrawer::~Physics3DDebugDrawer() in libcocos2d iOS.a(CCPhysics3DDebugDrawer.o)
cocos2d::DrawNode::~DrawNode() in libcocos2d iOS.a(CCDrawNode.o)
...
"_glGenVertexArraysOES", referenced from:
cocos2d::Renderer::setupVBOAndVAO() in libcocos2d iOS.a(CCRenderer.o)
cocos2d::MeshCommand::buildVAO() in libcocos2d iOS.a(CCMeshCommand.o)
cocos2d::TextureAtlas::setupVBOandVAO() in libcocos2d iOS.a(CCTextureAtlas.o)
cocos2d::CameraBackgroundSkyBoxBrush::initBuffer() in libcocos2d iOS.a(CCCameraBackgroundBrush.o)
cocos2d::Physics3DDebugDrawer::init() in libcocos2d iOS.a(CCPhysics3DDebugDrawer.o)
cocos2d::DrawNode::init() in libcocos2d iOS.a(CCDrawNode.o)
cocos2d::VertexAttribBinding::init(cocos2d::MeshIndexData*, cocos2d::GLProgramState*) in libcocos2d iOS.a(CCVertexAttribBinding.o)
...
"_glMapBufferOES", referenced from:
cocos2d::Renderer::drawBatchedTriangles() in libcocos2d iOS.a(CCRenderer.o)
cocos2d::TextureAtlas::drawNumberOfQuads(long, long) in libcocos2d iOS.a(CCTextureAtlas.o)
"_glUnmapBufferOES", referenced from:
cocos2d::Renderer::drawBatchedTriangles() in libcocos2d iOS.a(CCRenderer.o)
cocos2d::TextureAtlas::drawNumberOfQuads(long, long) in libcocos2d iOS.a(CCTextureAtlas.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
答案 0 :(得分:1)
在项目设置中,转到“构建阶段”和“链接二进制文件库”添加 OpenGLES.framework,UIKit.framework,ImageIO.framework,Foundation.framework和CoreGraphics.framework
清理项目并再次运行,希望它开始运行。