簡體   English   中英

qt creator opencv windows cmake錯誤

[英]qt creator opencv windows cmake error

我想為qt creator配置然后生成opencv庫以鏈接它們。 我打開了cmake 3.1.0並輸入了源代碼和構建路徑。

資源:

C:/Users/Philipp_Laptop/Downloads/opencv/sources
build: C:/opencv-mingw

然后我用路徑配置了mingw-compiler:

C:/Qt/Tools/mingw482_32/bin/gcc.exe
C:/Qt/Tools/mingw482_32/bin/g++.exe

配置成功后,我設置了with_Qt選項。 我配置了兩次,它顯示以下錯誤:


Detected version of GNU GCC: 48 (408)
CMake Warning (dev) at cmake/OpenCVUtils.cmake:261 (if):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "WIN32" will no longer be dereferenced when the
  policy is set to NEW.  Since the policy is not set the OLD behavior will be
  used.
Call Stack (most recent call first):
  CMakeLists.txt:127 (OCV_OPTION)
This warning is for project developers.  Use -Wno-dev to suppress it.

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:447 (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:447 (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:447 (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:447 (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:447 (include)


Looking for Q_WS_X11
Looking for Q_WS_X11 - not found
Looking for Q_WS_WIN
Looking for Q_WS_WIN - found
Looking for Q_WS_QWS
Looking for Q_WS_QWS - not found
Looking for Q_WS_MAC
Looking for Q_WS_MAC - not found
Found OpenGL: opengl32  
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
  Could NOT find Qt4 (missing: QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE
  QT_QTTEST_LIBRARY QT_UIC_EXECUTABLE) (found version "4.8.6")
Call Stack (most recent call first):
  C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:374 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindQt4.cmake:1331 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  cmake/OpenCVFindLibsGUI.cmake:34 (find_package)
  CMakeLists.txt:447 (include)


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

我在Windows下使用了CMake GUI ,所以我將參考這種方法。 讓我們從與CMAKE_PREFIX_PATH not defined相關的問題開始。 要解決此問題,您只需在CMAKE GUI上按ADD並添加名為CMAKE_PREFIX_PATH PATH類型的變量,其值為C:/Bin/Qt/5.3/mingw482_32/lib/cmake/但使用您自己的Qt5安裝。 您現在指向的目錄包含您需要的所有模塊:Qt5目錄,Qt5AxBase ...

此時按下configure,您應該使QT_QMAKE_EXECUTABLE無效。 在我的情況下你需要正確設置它: C:/Bin/Qt/5.3/mingw482_32/bin/qmake.exe

然后再次按配置,看看是否仍然存在一些錯誤(你有其他錯誤,我從未見過,但也許它們是以前的錯誤),在我的情況下,這解決了所有問題並且構建繼續進行。

MINGW配置似乎沒問題:我只是將bin MINGW路徑作為第一個條目放在PAT變量中並使用CMAKE中的默認編譯器(但您的解決方案與我的解決方案一樣有效)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM