Error building opencv with extra modules in Visual Studio
I have configured and generated opencv 3.2 with extra modules on CMAKE successfully using a 32-bit compiler of Visual Studio 2015 (vs14). However, when building this project in Visual Studio I get several errors. Below, you could find: small sample of the errors, the CMake ouput , the set of all errors,
Error Sample
LNK1120 50 unresolved externals opencv_hdf C:\OpenCV3_02_Custom\build\bin\Debug\opencv_hdf320d.dll 1
LNK1112 module machine type 'x64' conflicts with target machine type 'X86' opencv_python3 C:\OpenCV3_02_Custom\build\modules\python3\python35.lib(python35.dll) 1
CMake Ouput:
FP16: Compiler support is available
found IPP (ICV version): 9.0.1 [9.0.1]
at: C:/OpenCV3_02_Custom/build/3rdparty/ippicv/ippicv_win
Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
Found PythonInterp: C:/Users/Ibrahim/Anaconda3/python.exe (found suitable version "3.5.2", minimum required is "2.7")
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
Caffe: NO
Protobuf: NO
Glog: NO
freetype2: NO
harfbuzz: NO
CMake Warning at C:/OpenCV3_Custom/source/opencv_contrib/modules/matlab/CMakeLists.txt:58 (message):
Your compiler is 32-bit but your version of Matlab is 64-bit. To build
Matlab bindings, please switch to a 64-bit compiler.
Call Stack (most recent call first):
C:/OpenCV3_Custom/source/opencv_contrib/modules/matlab/CMakeLists.txt:67 (warn_mixed_precision)
Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
Tesseract: NO
Check contents of vgg_generated_48.i ...
Check contents of vgg_generated_64.i ...
Check contents of vgg_generated_80.i ...
Check contents of vgg_generated_120.i ...
Check contents of boostdesc_bgm.i ...
Check contents of boostdesc_bgm_bi.i ...
Check contents of boostdesc_bgm_hd.i ...
Check contents of boostdesc_binboost_064.i ...
Check contents of boostdesc_binboost_128.i ...
Check contents of boostdesc_binboost_256.i ...
Check contents of boostdesc_lbgm.i ...
General configuration for OpenCV 3.2.0 =====================================
Version control: unknown
Extra modules:
Location (extra): C:/OpenCV3_Custom/source/opencv_contrib/modules
Version control (extra): unknown
Platform:
Timestamp: 2017-02-28T15:51:02Z
Host: Windows 10.0.14393 AMD64
CMake: 3.7.1
CMake generator: Visual Studio 14 2015
CMake build tool: C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
MSVC: 1900
C/C++:
Built as dynamic libs?: YES
C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe (ver 19.0.23506.0)
C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast /wd4251 /wd4324 /wd4275 /wd4589 /MP4 /MD /O2 /Ob2 /DNDEBUG /Zi
C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast /wd4251 /wd4324 /wd4275 /wd4589 /MP4 /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
C Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast /MP4 ...
disable hdf module. disable python You have a 64 bits python I think. you cannot mixed 32 bits and 64 bits dll. Do you really need to build a 32 bits versions ?
Where do I choose to build a 64 bit version? I did not face an option to select
It is in cmake gui you have to select Visual Studio 14 2015 Win 64 generator