【问题标题】:CMake error: C++ 11 not supported on Mac high sierraCMake 错误:Mac high sierra 不支持 C++ 11
【发布时间】:2018-07-21 05:54:07
【问题描述】:

我试图使用this link 为 python 安装 opencv。运行 Cmake 命令后,它退出并显示错误 C++11 is not supported 尽管我安装了 Xcode。我还尝试使用$ set(CMAKE_CXX_STANDARD 11) 强制 Cmake 使用 C++ 11(因为我的 Cmake 版本是 3.10.2),但出现此错误:

syntax error near unexpected token `CMAKE_CXX_STANDARD'

此外,我尝试安装 gcc 以通过 this link 检查我的系统是否支持 C++ 11 编译器,在运行 $ make install 后我再次遇到终端错误,指出 ./fixincludes: No such file or directory。我该怎么办?

【问题讨论】:

  • 你能在终端运行 gcc --version 吗?版本号是多少?
  • @StefanoBuora 根据第一行我认为是 4.2.1,还是我读错了?配置: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM 版本 9.0.0 (clang-900.0.39.2) 目标: x86_64-apple-darwin17.3.0 线程模型:posix InstalledDir:/Library/Developer/CommandLineTools/usr/bin
  • 版本听起来不错,我安装了最新的Xcode版本也一样
  • gcc 4.2 比 C++11 早方式。这当然行不通。
  • 你为什么不使用自制软件(你在教程中安装了它)来安装 GCC?它默认安装最新版本的 GCC。

标签: python c++ macos opencv c++11


【解决方案1】:

Adrian 在compiling OpenCV for the macOS 上有一篇更新的博文。这些说明适用于 3.3.0 和 3.3.1。

【讨论】:

  • 谢谢,我再次执行了本教程建议的步骤,但同样的问题也发生了。
【解决方案2】:

在终端输入import cv2 之后,首先通过python2python3 命令打开python,现在一切正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-01-03
    • 1970-01-01
    • 1970-01-01
    • 2018-06-21
    • 2020-07-11
    • 2017-02-24
    相关资源
    最近更新 更多