在Windows 10上安装OpenCV和Extra模块Visual Studio 2015

时间:2017-07-15 11:01:11

标签: c++ opencv cmake-gui

我一直在尝试安装OpenCV额外模块以使用跟踪算法。我已按照本教程https://putuyuwono.wordpress.com/2015/04/23/building-and-installing-opencv-3-0-on-windows-7-64-bit/

下载了所有文件和CMake

但是,我开始在CMake-gui中进行配置,我得到一个我不太了解的错误。

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_8cf7a.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.8/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.0/build/CMakeFiles/CMakeTmp



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



      Generator: execution of make failed.  Make command was: "MSBuild.exe"
      "cmTC_8cf7a.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:127 (project)


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

我不太明白这意味着什么? 有谁能告诉我如何解决这个问题?

干杯

1 个答案:

答案 0 :(得分:4)

我定期使用OpenCV与visual c ++ 2015和2017。 我直接从源代码构建OpenCV,而不遵循您发布的链接。 我建议你从git

克隆OpenCV和OpenCV Extra Modules

您需要以下工具:git,cmake(我使用版本3.8.2),Visual C ++ 2015或Visual C ++ 2017

cd projects
git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git

打开cmake到你的projects/opencv,设置构建目录,例如build-vc140,选择Visual C ++ 14(对于visual c ++ 2015)或Visual C ++ 15(对于visual c ++ 2017)并运行configure。 设置opencv_controlib/modules的路径,同时设置安装库设置的路径CMAKE_INSTALL_PREFIX

生成,打开解决方案并构建install目标

要在项目中包含库,只需将OpenCV_DIR设置为已安装的路径

即可