简体   繁体   English

Xcode 5.1 build opencv在64位模拟器上失败

[英]Xcode 5.1 build opencv failed on 64 bit simulator

I updated Xcode to 5.1 and many errors appeared in my iOS app project which use opencv framework 2.4. 我将Xcode更新为5.1,并且在我的iOS应用程序项目中出现了许多使用opencv框架2.4的错误。 My computer is macbook air and OSX 10.9.2. 我的电脑是macbook air和OSX 10.9.2。

When I compile my project, it works fine when I'm using Iphone Retina (3.5-Inch ,4-Inch) Simulator. 当我编译我的项目时,它在我使用Iphone Retina(3.5英寸,4英寸)模拟器时工作正常。 But when I'm using Iphone Retina (4-Inch 64-bit) I got the following message when I try to build and run : 但是当我使用Iphone Retina(4英寸64位)时,我在尝试构建和运行时收到以下消息:

ld: warning: ignoring file /Users/mike/Documents/opencv2.framework/opencv2, missing required architecture x86_64 in file /Users/mike/Documents/opencv2.framework/opencv2 (3 slices)
Undefined symbols for architecture x86_64:
  "CvKNearest::CvKNearest(CvMat const*, CvMat const*, CvMat const*, bool, int)", referenced from:
  -[HomeViewController ocrTicket:] in HomeViewController.o
  "CvKNearest::~CvKNearest()", referenced from:
  -[HomeViewController ocrTicket:] in HomeViewController.o
  "cv::_InputArray::_InputArray(cv::Mat const&)", referenced from:
  -[HomeViewController ocrTicket:] in HomeViewController.o
  PreProcessImage(cv::Mat*, cv::Mat*, int, int) in HomeViewController.o
  PreProcessImageNew(cv::Mat*, cv::Mat*, int, int) in HomeViewController.o
  -[HomeViewController FromMat:ObtainRect:] in HomeViewController.o
...
ld: symbol(s) not found for architecture x86_64

Xcode upgrade to 5.1, apple default let all app through the 64 - bit compiler. Xcode升级到5.1,苹果默认让所有app都通过64位编译器。 By this way can close: selected the 通过这种方式可以关闭:选中了

Targets - > Build Settings - > Architectures. 目标 - >构建设置 - >体系结构。 Double-click the Architectures 双击架构

, choose other , delete in addition to the ,选择其他 ,删除除了

$(ARCH_STANDARD) (' - ') $(ARCH_STANDARD)(' - ')

, and then increase ,然后增加

armv7 and armv7s' + ' armv7和armv7s'+'

(point). (点)。 Compile the clean once again. 再次编译清洁

Short Answer: Remove arm64 from your list of Architectures in your build settings 简答:从构建设置中的架构列表中删除arm64

Long Answer: Since Xcode 5.1 the default is to include arm64 in the list of standard build architectures. 长答案:从Xcode 5.1开始,默认是在标准构建体系结构列表中包含arm64。 This will cause problems if you use a precompiled library, like OpenCV, that doesn't have a 64-bit slice because the the linker will not be able to find valid code. 如果您使用没有64位切片的预编译库(如OpenCV),这将导致问题,因为链接器将无法找到有效代码。 Don't worry about removing arm64 from your architecture list. 不要担心从架构列表中删除arm64。 As long as it is in the Valid Architectures list it will still run on a 64-bit platform. 只要它位于Valid Architectures列表中,它仍然可以在64位平台上运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM