OpenCV构建问题,找不到ext / atomicity.h [英] OpenCV build issue, can't find ext/atomicity.h

查看:2348
本文介绍了OpenCV构建问题,找不到ext / atomicity.h的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在构建包含OpenCV的项目时,我得到编译器错误抱怨< \\ text / atomicity.h> 。环境是针对iOS的Xcode 4.5。它为模拟器编译良好,但在为设备构建时失败。这是错误文本:

I get the compiler error complaining about <ext/atomicity.h> when building a project incorporating OpenCV. Environment is Xcode 4.5 targeting iOS. It compiles fine for the simulator but fails when building for the device. Here's the error text:

/Users/Nick/projects/ios/opencv2.framework/Headers/core/operations.hpp:65:16: fatal error: 'ext/atomicity.h' file not found
      #include <ext/atomicity.h>

我正在使用opencv2.framework,使用指令此处

I'm using the opencv2.framework, builusing cmake, using the instructions here.

推荐答案

默认情况下,XCode 4.5使用 libc ++(支持C ++ 11的LLVM C ++标准库)生成要构建的新项目。但OpenCV预计将针对GNU libstdc ++(GNU C ++标准库)构建。 < ext / atomicity.h> 显然是GNU扩展,不属于LLVM libc ++标准库。

By default XCode 4.5 generates new projects to build using the libc++ (LLVM C++ standard library with C++ 11 support). But OpenCV is expecting to be built against the GNU libstdc++ (GNU C++ standard library). <ext/atomicity.h> is apparently a GNU extension and isn't part of the LLVM libc++ standard library.

在项目的目标设置中,为C ++标准库设置选择 libstdc ++(GNU C ++标准库)

In your project's target settings, select libstdc++ (GNU C++ standard library) for the C++ Standard Library setting.

很可能atomicity.h要求可以用opencv来解决,或者以LLVM libc ++兼容的方式完成。我没有探究过这个问题,但如果有人知道如何做到这一点,我会很感兴趣。

Very likely the atomicity.h requirement could be factored out of opencv or otherwise done in a LLVM libc++ compatible way. I didn't explore this but would be interested if anyone had insight on how this could be done.

这篇关于OpenCV构建问题,找不到ext / atomicity.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆