首页 > 代码库 > xcode 运行 cocos2dx 项目问题总结

xcode 运行 cocos2dx 项目问题总结

由于管理公司游戏项目ios的打包,且都是cocos2dx项目。经常碰到各种各样的问题,打算以后碰到的问题记录下来...

 

1.这个是折腾了我挺久的一个问题

 

Undefined symbols for architecture armv7:
"cocos2d::CCDictionary::removeObjectForKey(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
tolua_Cocos2d_CCDictionary_removeObjectForKey00(lua_State*) in liblua.a(LuaCocos2d.o)
tolua_Cocos2dx_ActionTimeline_clearFrameEventCallFunc00(lua_State*) in liblua.a(lua_cocos2dx_cocostudio_manual.o)
cocostudio::timeline::ActionTimelineCache::removeAction(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libextensions.a(CCActionTimelineCache.o)
cocos2d::extension::CCArmature::removeBone(cocos2d::extension::CCBone*, bool) in libextensions.a(CCArmature.o)
cocos2d::extension::CCArmatureDataManager::removeArmatureData(char const*) in libextensions.a(CCArmatureDataManager.o)
cocos2d::extension::CCArmatureDataManager::removeAnimationData(char const*) in libextensions.a(CCArmatureDataManager.o)
cocos2d::extension::CCArmatureDataManager::removeTextureData(char const*) in libextensions.a(CCArmatureDataManager.o)
...
"non-virtual thunk to cocos2d::CCTextFieldTTF::getContentText()", referenced from:
vtable for cocos2d::ui::UICCTextField in libextensions.a(UITextField.o)
"cocos2d::CCDictionary::valueForKey(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
tolua_Cocos2d_CCDictionary_valueForKey00(lua_State*) in liblua.a(LuaCocos2d.o)
"non-virtual thunk to cocos2d::CCTextFieldTTF::attachWithIME()", referenced from:
vtable for cocos2d::ui::UICCTextField in libextensions.a(UITextField.o)
"non-virtual thunk to cocos2d::CCTextFieldTTF::detachWithIME()", referenced from:
vtable for cocos2d::ui::UICCTextField in libextensions.a(UITextField.o)
"cocos2d::CCString::create(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
cocos2d::extension::CCControlButton::initWithLabelAndBackgroundSprite(cocos2d::CCNode*, cocos2d::extension::CCScale9Sprite*) in libextensions.a(CCControlButton.o)
cocos2d::extension::CCControlButton::getTitleForState(unsigned int) in libextensions.a(CCControlButton.o)
cocos2d::extension::CCControlButton::setTitleTTFForState(char const*, unsigned int) in libextensions.a(CCControlButton.o)
cocos2d::extension::CCControlButton::setTitleBMFontForState(char const*, unsigned int) in libextensions.a(CCControlButton.o)
cocos2d::extension::CCBAnimationManager::addDocumentCallbackName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in libextensions.a(CCBAnimationManager.o)
cocos2d::extension::CCBAnimationManager::addDocumentOutletName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in libextensions.a(CCBAnimationManager.o)
cocos2d::extension::CCBReader::readCallbackKeyframesForSeq(cocos2d::extension::CCBSequence*) in libextensions.a(CCBReader.o)
...
"non-virtual thunk to cocos2d::CCTextFieldTTF::canAttachWithIME()", referenced from:
vtable for cocos2d::ui::UICCTextField in libextensions.a(UITextField.o)
"non-virtual thunk to cocos2d::CCTextFieldTTF::canDetachWithIME()", referenced from:
vtable for cocos2d::ui::UICCTextField in libextensions.a(UITextField.o)
"cocos2d::CCFileUtils::getPathForFilename(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
vtable for CFileUtilsZpk in FileUtilsZpk.o
"cocos2d::CCDictionary::objectForKey(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
cocos2d::extension::CCBAnimationManager::getBaseValue(cocos2d::CCNode*, char const*) in libextensions.a(CCBAnimationManager.o)
cocos2d::extension::CCBAnimationManager::actionForCallbackChannel(cocos2d::extension::CCBSequenceProperty*) in libextensions.a(CCBAnimationManager.o)
cocos2d::extension::CCBAnimationManager::runAnimationsForSequenceIdTweenDuration(int, float) in libextensions.a(CCBAnimationManager.o)
tolua_Cocos2d_CCDictionary_objectForKey00(lua_State*) in liblua.a(LuaCocos2d.o)
cocostudio::timeline::NodeReader::loadNode(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> > const&, cocos2d::CCNode*) in libextensions.a(CCNodeReader.o)
cocostudio::timeline::ActionTimelineCache::createAction(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libextensions.a(CCActionTimelineCache.o)
cocostudio::timeline::ActionTimelineCache::loadAnimationActionWithContent(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libextensions.a(CCActionTimelineCache.o)
...
"cocos2d::CCFileUtilsIOS::getFullPathForDirectoryAndFilename(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
vtable for CFileUtilsZpk in FileUtilsZpk.o
"cocos2d::CCFileUtilsIOS::writeToFile(cocos2d::CCDictionary*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
vtable for CFileUtilsZpk in FileUtilsZpk.o
"cocos2d::CCUserDefault::getStringForKey(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
NewAccMainMenu::loadAccInfo() in LoginMenu.o
QuestGuideMenu::LoadConfig() in MapGuideMenu.o
"cocos2d::CCFileUtilsIOS::createCCArrayWithContentsOfFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
vtable for CFileUtilsZpk in FileUtilsZpk.o
"cocos2d::CCPointArray::setControlPoints(std::__1::vector<cocos2d::CCPoint*, std::__1::allocator<cocos2d::CCPoint*> >*)", referenced from:
tolua_Cocos2d_CCPointArray_setControlPoints00(lua_State*) in liblua.a(LuaCocos2d.o)
"cocos2d::CCUserDefault::setStringForKey(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
NewAccMainMenu::SaveAccInfo() in LoginMenu.o
QuestGuideMenu::SaveConfig() in MapGuideMenu.o
tolua_Cocos2d_CCUserDefault_setStringForKey00(lua_State*) in liblua.a(LuaCocos2d.o)
"cocos2d::CCDictionary::setObject(cocos2d::CCObject*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
addValueToCCDict(objc_object*, objc_object*, cocos2d::CCDictionary*) in FMLayerWebView.o
cocos2d::extension::CCBAnimationManager::setBaseValue(cocos2d::CCObject*, cocos2d::CCNode*, char const*) in libextensions.a(CCBAnimationManager.o)
cocos2d::extension::CCBReader::readNodeGraph(cocos2d::CCNode*) in libextensions.a(CCBReader.o)
cocos2d::extension::CCNodeLoader::onHandlePropTypeFloat(cocos2d::CCNode*, cocos2d::CCNode*, char const*, float, cocos2d::extension::CCBReader*) in libextensions.a(CCNodeLoader.o)
cocos2d::extension::CCNodeLoader::onHandlePropTypeInteger(cocos2d::CCNode*, cocos2d::CCNode*, char const*, int, cocos2d::extension::CCBReader*) in libextensions.a(CCNodeLoader.o)
cocos2d::extension::CCNodeLoader::onHandlePropTypeCheck(cocos2d::CCNode*, cocos2d::CCNode*, char const*, bool, cocos2d::extension::CCBReader*) in libextensions.a(CCNodeLoader.o)
cocos2d::extension::CCNodeLoader::onHandlePropTypeString(cocos2d::CCNode*, cocos2d::CCNode*, char const*, char const*, cocos2d::extension::CCBReader*) in libextensions.a(CCNodeLoader.o)
...
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Showing first 200 warnings only

这个也是比较多出现的问题,找不到所要的符号。但是其实我的.a静态库是存在的,并且也包含了

解决方案:

1. 将游戏项目的 Deployment Target 改成7.0以下

2. 将cocos2dx重新编译一遍, Build Settings->Apple LLVM *.0 -Language -C++  按下面配置

技术分享

 

其他cocosDenshion和extensions也按这个配置

然后该问题解决

 

...(待续)

xcode 运行 cocos2dx 项目问题总结