cspg11
cspg11

Reputation: 71

OpenCV install opencv_contrib modules on Windows with CMake

I've been trying to install the additional modules in opencv_contrib but I keep getting errors when trying to configure in CMake.

These are the steps I've taken so far:

  1. Downloaded opencv and opencv_contrib from github.
  2. Pasted the modules I want from opencv_contrib into opencv/modules.
  3. Created a build folder in opencv, seen here.
  4. In CMake gui, I set the source code to C:/opencv-3.1.0-dev and set the build folder to the build folder contained in C:/opencv-3.1.0-dev.
  5. After pressing configure I set the generator for the project as visual studio 15.
  6. I specified the native C and C++ compilers to:

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

When I confirm this and the configure progressing I'm provided with this error:

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".

Please could someone explain how to fix this or is there another way to include the modules I need?

I've looked around and it was suggested to run the cl.exe as an adminstrator but this didn't resolve the problem.

Upvotes: 4

Views: 1492

Answers (1)

cspg11
cspg11

Reputation: 71

I managed to get it working, thought I'd update here in case anyone else had a similar problem.

Instead of choosing the generator for the project as Visual Studio 15, the actual generator I should have chosen was Visual Studio 14 Win64.

Upvotes: 3

Related Questions