qt创建者opencv窗口cmake错误 [英] qt creator opencv windows cmake error

查看:640
本文介绍了qt创建者opencv窗口cmake错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想配置,然后生成opencv库qt creator链接他们。
我打开cmake 3.1.0并输入源代码和构建路径。



源:

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






然后我使用以下路径配置mingw编译器:

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






配置成功后,设置with_Qt选项。
我配置了两次,它显示以下错误:






 检测到的版本的GNU GCC:48(408)
cmake / OpenCVUtils.cmake的CMake警告(dev):261(if):
未设置策略CMP0054:仅将if()或
关键字。运行cmake --help-policy CMP0054了解策略
的详细信息。使用cmake_policy命令设置策略并抑制此
警告。


策略设置为NEW时,WIN32之类的引用变量将不再被取消引用。由于策略未设置,OLD行为将使用

调用堆栈(最近调用的第一个):
CMakeLists.txt:127(OCV_OPTION)
此警告是为项目开发人员。使用-Wno-dev来禁止它。

CMake警告在cmake / OpenCVFindLibsGUI.cmake:18(find_package):
通过不提供FindQt5Core.cmake在CMAKE_MODULE_PATH这个项目有
要求CMake找到一个包配置文件由Qt5Core提供,但
CMake没有找到一个。

无法使用以下名称的任何
查找Qt5Core提供的包配置文件:

Qt5CoreConfig.cmake
qt5core-config。 cmake

将安装前缀Qt5Core添加到CMAKE_PREFIX_PATH或将
Qt5Core_DIR添加到包含上述文件之一的目录。如果
Qt5Core提供了单独的开发包或SDK,请确保它已经安装

调用堆栈(最近调用):
CMakeLists.txt:447(include)


CMake在cmake警告/ OpenCVFindLibsGUI.cmake:19(find_package) :
通过在CMAKE_MODULE_PATH中没有提供FindQt5Gui.cmake,这个项目有
要求CMake找到由Qt5Gui提供的包配置文件,但是
CMake没有找到一个。

无法使用以下名称的任何
查找Qt5Gui提供的包配置文件:

Qt5GuiConfig.cmake
qt5gui-config。 cmake

将安装前缀Qt5Gui添加到CMAKE_PREFIX_PATH或将
Qt5Gui_DIR添加到包含上述文件之一的目录。如果Qt5Gui
提供单独的开发包或SDK,请确保它已安装

调用堆栈(最近调用的第一个):
CMakeLists.txt:447(include)


CMake在cmake警告/ OpenCVFindLibsGUI.cmake:20(find_package) :
通过在CMAKE_MODULE_PATH中不提供FindQt5Widgets.cmake,这个项目
要求CMake找到
Qt5Widgets提供的包配置文件,但是CMake没有找到。

找不到Qt5Widgets提供的包配置文件,
使用以下任何名称:

Qt5WidgetsConfig.cmake
qt5widgets-config。 cmake

将安装前缀Qt5Widgets添加到CMAKE_PREFIX_PATH或将
Qt5Widgets_DIR添加到包含上述文件之一的目录。如果
Qt5Widgets提供单独的开发包或SDK,请确保它已安装

调用堆栈(最近调用):
CMakeLists.txt:447(include)


CMake在cmake警告/ OpenCVFindLibsGUI.cmake:21(find_package) :
通过在CMAKE_MODULE_PATH中不提供FindQt5Test.cmake,这个项目有
要求CMake找到一个由Qt5Test提供的包配置文件,但
CMake没有找到一个。

无法使用以下名称的任何
查找Qt5Test提供的包配置文件:

Qt5TestConfig.cmake
qt5test-config。 cmake

将安装前缀Qt5Test添加到CMAKE_PREFIX_PATH或将
Qt5Test_DIR添加到包含上述文件之一的目录。如果
Qt5Test提供单独的开发包或SDK,请确保它已安装

调用堆栈(最近调用):
CMakeLists.txt:447(include)


CMake在cmake警告/ OpenCVFindLibsGUI.cmake:22(find_package) :
通过在CMAKE_MODULE_PATH中不提供FindQt5Concurrent.cmake,这个
项目要求CMake找到
Qt5Concurrent提供的包配置文件,但是CMake没有找到。

无法使用以下任何名称找到Qt5Concurrent
提供的程序包配置文件:

Qt5ConcurrentConfig.cmake
qt5concurrent-config。 cmake

将安装前缀Qt5Concurrent添加到CMAKE_PREFIX_PATH或将
Qt5Concurrent_DIR添加到包含上述文件之一的目录。如果
Qt5Concurrent提供单独的开发包或SDK,请确保已经安装

调用堆栈(最近调用):
CMakeLists.txt:447(include)


寻找Q_WS_X11
寻找Q_WS_X11 - 找不到
寻找Q_WS_WIN
寻找Q_WS_WIN - 找到
寻找Q_WS_QWS
寻找Q_WS_QWS - 找不到
寻找Q_WS_MAC
寻找Q_WS_MAC - 找不到
发现OpenGL:opengl32
在C:/ Program Files(x86)上的CMake错误/CMake/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:138(message):
找不到
调用堆栈(最近调用):
C:/ Program Files(x86)/ CMake / Qt4(缺少:QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE
QT_QTTEST_LIBRARY QT_UIC_EXECUTABLE)共享/ cmake-3.1 /模块/ FindPackageHandleStandardArgs.cmake:374(_FPHSA_FAILURE_MESSAGE)
C:/程序文件(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)


配置不完整,发生错误!
另请参见C:/opencv-mingw/CMakeFiles/CMakeOutput.log。
另请参见C:/opencv-mingw/CMakeFiles/CMakeError.log。





解决方案

我在Windows下使用 CMake GUI ,所以我会参考这个方法。
让我们从与 CMAKE_PREFIX_PATH未定义相关的问题开始。
要解决这个问题,您只需在 CMAKE GUI 上按 ADD ,并添加名为 CMAKE_PREFIX_PATH $ c>与值 C:/Bin/Qt/5.3/mingw482_32/lib/cmake / ,但使用您自己的安装 Qt5 。现在你指定的目录包含你需要的所有模块:Qt5目录,Qt5AxBase ...



此时你按配置,你应该有 QT_QMAKE_EXECUTABLE 无效。您需要正确设置,在我的情况下: C:/Bin/Qt/5.3/mingw482_32/bin/qmake.exe



然后再次按配置,看看是否仍然存在一些错误(你有其他错误,我从来没有看到,但也许他们是以前的结果),在我的情况下,这解决了所有问题,并继续构建。 / p>

配置看起来不错:我将PING变量中的bin MINGW路径作为第一个条目并使用默认编译器来自 CMAKE (但您的解决方案与我的一样有效)。


I want to configure and then generate opencv library for qt creator to link them. I opened cmake 3.1.0 and typed in the source and build path.

source:

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


Then I configured the mingw-compiler with the path:

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


After successful configure i set the with_Qt option. I configured it twice and it shows me the following error:


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


解决方案

I used CMake GUI under Windows for this so I'll refer to this approach. Let's start from problems related to CMAKE_PREFIX_PATH not defined. To solve this you simply have to press ADD on the CMAKE GUI and add the variable of type PATH named CMAKE_PREFIX_PATH with value C:/Bin/Qt/5.3/mingw482_32/lib/cmake/ but using your own installation of Qt5. The directory you point now contains all modules you need: Qt5 directory, Qt5AxBase...

At this point you press configure and you should have QT_QMAKE_EXECUTABLE not valid. You need to set it properly, in my case: C:/Bin/Qt/5.3/mingw482_32/bin/qmake.exe.

Then press configuration again and see if some error is still present (you have others error I never saw but maybe they are consequence of the previous ones), in my case this solved all issues and the build proceeded.

The MINGW configuration seems to be fine: I did slightly different just putting the bin MINGW path in PAT variable as first entry and using the default compiler from CMAKE (but your solution is as valid as my one).

这篇关于qt创建者opencv窗口cmake错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆