设备的Cocos2d ARC链接错误,但为模拟器构建

时间:2014-06-05 04:45:27

标签: objective-c xcode cocoa-touch cocos2d-iphone automatic-ref-counting

您正在按照本教程为我的cocos2d项目启用ARC

http://www.learn-cocos2d.com/2012/04/enabling-arc-cocos2d-project-howto-stepbystep-tutorialguide/

基本思想是使用cocos2d作为静态库并禁用弧。它适用于模拟器,但在我的iPhone 5s上崩溃

  "_OBJC_CLASS_$_CCScaleTo", referenced from:
      objc-class-ref in Helper.o
  "_OBJC_CLASS_$_CCTexture2D", referenced from:
      objc-class-ref in AppDelegate.o
  "_ccGLBlendFunc", referenced from:
      -[SlidingMenuGrid visit] in SlidingMenuGrid.o
  "_OBJC_CLASS_$_CCLayer", referenced from:
      _OBJC_CLASS_$_SlidingMenuGrid in SlidingMenuGrid.o
      _OBJC_CLASS_$_GameScene in GameScene.o
      _OBJC_CLASS_$_LevelScene in LevelScene.o
      _OBJC_CLASS_$_Mask in Mask.o
      _OBJC_CLASS_$_MainScene in MainScene.o
      _OBJC_CLASS_$_ResultScene in ResultScene.o
      _OBJC_CLASS_$_PackScene in PackScene.o
      ...
  "_ccDrawPoints", referenced from:
      -[SlidingMenuGrid visit] in SlidingMenuGrid.o
  "_ccDrawPoint", referenced from:
      -[SlidingMenuGrid visit] in SlidingMenuGrid.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我对cocos2d库和游戏目标使用armv7和armv7s。

1 个答案:

答案 0 :(得分:0)

假设您拥有最新版本的Xcode,其中存在以下选项:

对于您的两个项目,请进入每个目标的构建设置,然后选择"标准体系结构(armv7,armv7s)" “架构”字段中的选项。还有"最新iOS(iOS 7.0)"选择用于Base SDK。对于Valid Architectures字段,至少包含" arm64,armv7和armv7s"。

如果您有不同的东西,这应该可以解决您缺少armv7的问题。如果您最初使用较旧版本的Xcode创建项目,则很可能您的游戏/应用程序项目有所不同。