【问题标题】:OpenCV install opencv_contrib modules on Windows with CMakeOpenCV 使用 CMake 在 Windows 上安装 opencv_contrib 模块
【发布时间】:2017-04-02 09:22:27
【问题描述】:

我一直在尝试在 opencv_contrib 中安装其他模块,但在尝试在 CMake 中进行配置时不断出错。

这些是我到目前为止所采取的步骤:

  1. 从 github 下载了 opencv 和 opencv_contrib。
  2. 将我想要的模块从 opencv_contrib 粘贴到 opencv/modules 中。
  3. 在 opencv 中创建了一个构建文件夹, seen here.
  4. 在 CMake gui 中,我将源代码设置为 C:/opencv-3.1.0-dev,并将构建文件夹设置为 C:/opencv-3.1.0-dev 中包含的构建文件夹。
  5. 按下配置后,我将项目的生成器设置为 Visual Studio 15。
  6. 我将本机 C 和 C++ 编译器指定为:

C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe

当我确认这一点并进行配置时,我收到此错误:

The CXX compiler identification is unknown
The C compiler identification is unknown
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
CMake Error: Generator: execution of make failed. Make command was: "MSBuild.exe" "cmTC_7c114.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=15.0"
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.7/Modules/CMakeTestCXXCompiler.cmake:44 (message):
  The C++ compiler "C:/Program Files (x86)/Microsoft Visual Studio
  14.0/VC/bin/cl.exe" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: C:/opencv-3.1.0-dev/build/CMakeFiles/CMakeTmp

  Run Build Command:"MSBuild.exe" "cmTC_7c114.vcxproj"
  "/p:Configuration=Debug" "/p:VisualStudioVersion=15.0"


  Generator: execution of make failed.  Make command was: "MSBuild.exe"
  "cmTC_7c114.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=15.0"


  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:98 (project)


Configuring incomplete, errors occurred!
See also "C:/opencv-3.1.0-dev/build/CMakeFiles/CMakeOutput.log".
See also "C:/opencv-3.1.0-dev/build/CMakeFiles/CMakeError.log".

请有人解释一下如何解决这个问题,或者还有其他方法可以包含我需要的模块吗?

我环顾四周,有人建议以管理员身份运行 cl.exe,但这并没有解决问题。

【问题讨论】:

    标签: windows opencv cmake


    【解决方案1】:

    我设法让它工作了,我想我会在这里更新以防其他人遇到类似问题。

    我应该选择的实际生成器是 Visual Studio 14 Win64,而不是为项目选择 Visual Studio 15。

    【讨论】:

    • 您使用的是 Visual Studio 2017 吗?抱歉,我对他们的命名约定感到困惑
    猜你喜欢
    • 2017-11-07
    • 2017-10-02
    • 2016-02-18
    • 2015-10-29
    • 1970-01-01
    • 1970-01-01
    • 2018-04-17
    • 2016-04-19
    • 1970-01-01
    相关资源
    最近更新 更多