架构armv7的未定义符号 - 使用Xcode 6.0.1和Cocos2d-x 3.2

时间:2014-10-12 12:24:57

标签: ios xcode cocos2d-x

当我选择“Build Active Architecture Only”=“YES”时,我可以在我的设备中运行该项目。但是当我选择“否”时,它会显示同一项目中的200多个错误。

前提是,我选择标准体系结构(armv7,arm64)作为架构,arm64,armv7,armv7s作为此项目的有效架构。

以下是我收到的错误的一部分:

ld: warning: ld: warning: ignoring file /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libbox2d iOS.a, file was built for archive which is not the architecture being linked (armv7): /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libbox2d iOS.aignoring file /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libchipmunk iOS.a, file was built for archive which is not the architecture being linked (armv7): /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libchipmunk iOS.a

ld: warning: ignoring file /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libcocos2dx-extensions iOS.a, file was built for archive which is not the architecture being linked (armv7): /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libcocos2dx-extensions iOS.a
ld: warning: ignoring file /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libCocosDenshion iOS.a, file was built for archive which is not the architecture being linked (armv7): /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libCocosDenshion iOS.a
ld: warning: ignoring file /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libcocos2dx iOS.a, file was built for archive which is not the architecture being linked (armv7): /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libcocos2dx iOS.a

Undefined symbols for architecture armv7:
  "cocos2d::Touch::getLocation() const", referenced from:
  Credits::onTouchBegan(cocos2d::Touch*, cocos2d::Event*) in Credits.o
  Credits::onTouchMoved(cocos2d::Touch*, cocos2d::Event*) in Credits.o
  "cocos2d::MoveTo::create(float, cocos2d::Vec2 const&)", referenced from:
  Credits::resetCreditAction() in Credits.o
  "cocos2d::CallFunc::create(std::__1::function<void ()> const&)", referenced from:
  Credits::resetCreditAction() in Credits.o
  "cocos2d::Application::setAnimationInterval(double)", referenced from:
  vtable for AppDelegate in AppDelegate.o
  "cocos2d::Director::runWithScene(cocos2d::Scene*)", referenced from:
  AppDelegate::applicationDidFinishLaunching() in AppDelegate.o
  "cocos2d::Application::~Application()", referenced from:
  AppDelegate::~AppDelegate() in AppDelegate.o
  "cocos2d::Application::Application()", referenced from:
  AppDelegate::AppDelegate() in AppDelegate.o

2 个答案:

答案 0 :(得分:1)

仅在有效的架构以及游戏和cocos2d-x项目的架构部分添加armv7和armv7s。 (在项目和目标部分构建设置中)

答案 1 :(得分:0)

我已在我的Cocos2d-x 3.7项目中使用以下设置修复了此问题。

  • 在Xcode中选择您的顶级项目(在本例中为'ZooCubes')
  • 将iOS部署目标设置为“iOS 7”
  • 将有效架构设置为:“arm64 arm7”
  • 还要确保将架构设置为“标准架构arm7,arm64”

请务必为cocos2d_libs.xcodeproj重复此过程

enter image description here

当类引用缺少的框架时,有时也会显示相同的错误消息。在我的情况下,我必须添加GameKit框架,因为我的一个类试图引用它。

最后,我还遇到了一些情况(例如在cocos2dx-2.2.6中创建一个新项目),其中“Build Active Architecture Only”选项需要为所有目标设置为“No”才能修复'Undefined符号的错误。