cmake配置opencv的时候出现的错误及解决方法

cmake 配置opencv的时候出现的错误:

-- Detected version of GNU GCC: 54 (504)
-- Found ZLIB: /usr/lib/i386-linux-gnu/libz.so (found suitable version "1.2.8", minimum required is "1.2.3") 
-- Could NOT find TIFF (missing:  TIFF_LIBRARY TIFF_INCLUDE_DIR) ``
-- Could NOT find JPEG (missing:  JPEG_LIBRARY JPEG_INCLUDE_DIR) 
-- Could NOT find Jasper (missing:  JASPER_LIBRARIES JASPER_INCLUDE_DIR) 
-- Found ZLIB: /usr/lib/i386-linux-gnu/libz.so (found version "1.2.8") 
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:18 (find_package):
  By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Core", but
  CMake did not find one.
 
  Could not find a package configuration file provided by "Qt5Core" with any
  of the following names:
 
    Qt5CoreConfig.cmake
    qt5core-config.cmake
 
  Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
  "Qt5Core_DIR" to a directory containing one of the above files.  If
  "Qt5Core" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:535 (include)
 
 
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:19 (find_package):
  By not providing "FindQt5Gui.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Gui", but
  CMake did not find one.
 
  Could not find a package configuration file provided by "Qt5Gui" with any
  of the following names:
 
    Qt5GuiConfig.cmake
    qt5gui-config.cmake
 
  Add the installation prefix of "Qt5Gui" to CMAKE_PREFIX_PATH or set
  "Qt5Gui_DIR" to a directory containing one of the above files.  If "Qt5Gui"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:535 (include)
 
 
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:20 (find_package):
  By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Widgets", but CMake did not find one.
 
  Could not find a package configuration file provided by "Qt5Widgets" with
  any of the following names:
 
    Qt5WidgetsConfig.cmake
    qt5widgets-config.cmake
 
  Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
  "Qt5Widgets_DIR" to a directory containing one of the above files.  If
  "Qt5Widgets" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:535 (include)
 
 
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:21 (find_package):
  By not providing "FindQt5Test.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Test", but
  CMake did not find one.
 
  Could not find a package configuration file provided by "Qt5Test" with any
  of the following names:
 
    Qt5TestConfig.cmake
    qt5test-config.cmake
 
  Add the installation prefix of "Qt5Test" to CMAKE_PREFIX_PATH or set
  "Qt5Test_DIR" to a directory containing one of the above files.  If
  "Qt5Test" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:535 (include)
 
 
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:22 (find_package):
  By not providing "FindQt5Concurrent.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Qt5Concurrent", but CMake did not find one.
 
  Could not find a package configuration file provided by "Qt5Concurrent"
  with any of the following names:
 
    Qt5ConcurrentConfig.cmake
    qt5concurrent-config.cmake
 
  Add the installation prefix of "Qt5Concurrent" to CMAKE_PREFIX_PATH or set
  "Qt5Concurrent_DIR" to a directory containing one of the above files.  If
  "Qt5Concurrent" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:535 (include)
 
 
-- Checking for module 'gstreamer-video-1.0'
--   No package 'gstreamer-video-1.0' found
-- Checking for module 'gstreamer-app-1.0'
--   No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0'
--   No package 'gstreamer-riff-1.0' found
-- Checking for module 'gstreamer-pbutils-1.0'
--   No package 'gstreamer-pbutils-1.0' found
-- Checking for module 'gstreamer-base-0.10'
--   No package 'gstreamer-base-0.10' found
-- Checking for module 'gstreamer-video-0.10'
--   No package 'gstreamer-video-0.10' found
-- Checking for module 'gstreamer-app-0.10'
--   No package 'gstreamer-app-0.10' found
-- Checking for module 'gstreamer-riff-0.10'
--   No package 'gstreamer-riff-0.10' found
-- Checking for module 'gstreamer-pbutils-0.10'
--   No package 'gstreamer-pbutils-0.10' found
-- Checking for module 'libdc1394-2'
--   No package 'libdc1394-2' found
-- Checking for module 'libdc1394'
--   No package 'libdc1394' found
-- Checking for module 'libv4l1'
--   No package 'libv4l1' found
-- Checking for module 'libv4l2'
--   No package 'libv4l2' found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Checking for module 'libavcodec'
--   No package 'libavcodec' found
-- Checking for module 'libavformat'
--   No package 'libavformat' found
-- Checking for module 'libavutil'
--   No package 'libavutil' found
-- Checking for module 'libswscale'
--   No package 'libswscale' found
-- Checking for module 'libavresample'
--   No package 'libavresample' found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - not found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- Checking for module 'libgphoto2'
--   No package 'libgphoto2' found
-- On 32-bit Linux IPP can not currently be used with dynamic libs because of linker errors. Set BUILD_SHARED_LIBS=OFF
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR= option to cmake
-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.12", minimum required is "2.7") 
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.5.1", minimum required is "3.4") 
-- Could NOT find PythonLibs (missing:  PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version "3.5.1")
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named 'numpy'
-- Could NOT find JNI (missing:  JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
-- Could NOT find Matlab (missing:  MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) 
-- 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
CMake Error at cmake/OpenCVUtils.cmake:857 (file):
  file MD5 failed to read file
  "/home/yalishanda/Downloads/opencv-3.1.0/3rdparty/tinydnn/": Success
Call Stack (most recent call first):
  /home/yalishanda/Downloads/opencv_contrib-master/modules/dnn_modern/CMakeLists.txt:20 (ocv_download)
 
 
-- Downloading ...
CMake Error at cmake/OpenCVUtils.cmake:895 (file):
  file DOWNLOAD cannot open file for write.
Call Stack (most recent call first):
  /home/yalishanda/Downloads/opencv_contrib-master/modules/dnn_modern/CMakeLists.txt:20 (ocv_download)
 
 
CMake Error at cmake/OpenCVUtils.cmake:899 (message):
  Failed to download .  Status=
Call Stack (most recent call first):
  /home/yalishanda/Downloads/opencv_contrib-master/modules/dnn_modern/CMakeLists.txt:20 (ocv_download)
 
 
-- Configuring incomplete, errors occurred!
See also "/home/yalishanda/Downloads/opencv-3.1.0/CMakeFiles/CMakeOutput.log".
See also "/home/yalishanda/Downloads/opencv-3.1.0/CMakeFiles/CMakeError.log".

解决方法:
在opencv源码目录中,我的是 E:\QT\opencv-3.4.0\opencv-3.4.0
找到CMakeLists.txt 文件,在该文件中添加

set (CMAKE_PREFIX_PATH "D:\\Qt\\Qt5.10.0\\5.10.0\\msvc2015\\")

其中 msvc2015对应cmake配置opencv时候的编译器选项。

你可能感兴趣的:(QT5,C++,opencv)