为Qt编译OpenCV时出错 [英] Error when compiling OpenCV for Qt

查看:334
本文介绍了为Qt编译OpenCV时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了在Qt中使用OpenCV,我必须通过cmake用MinGW对其进行编译.

In order to use OpenCV in Qt, I have to compile it with MinGW by cmake.

软件如下:

  • Qt 5.4.0
  • Opencv 2.4.11
  • CMake 3.2.2
  • MinGW版本未知,GCC 4.8.1

我制作文件时发生致命错误,根本不知道如何解决.

A fatal error occurred when I make file and I have no idea how to solve it at all.

[ 29%] Automatic moc for target opencv_highgui
Generating moc_window_QT.cpp
Exit code 0xc000007b

AUTOGEN: error: process for C:/opencvbuild/modules/highgui/moc_window_QT.cpp failed:
Exit code 0xc000007b

moc failed...
modules\highgui\CMakeFiles\opencv_highgui_automoc.dir\build.make:48: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui_automoc' failed
mingw32-make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui_automoc] Error 1

CMakeFiles\Makefile2:2066: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui_automoc.dir/all' failed
mingw32-make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui_automoc.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

这些消息以cmd显示.

These messages are shown in cmd.

然后我修改了CMakeLists.txt,SET(CMAKE_AUTOMOC OFF)

Then I revised CMakeLists.txt, SET(CMAKE_AUTOMOC OFF)

modules\highgui\CMakeFiles\opencv_highgui_automoc.dir\build.make:64: recipe for target 'modules/highgui/qrc_window_QT.cpp' failed

有人知道解决方案吗?

推荐答案

2个项目可以尝试.

2 items to try.

  1. 尝试将makeVERBOSE=1一起运行以增加makefile上的输出.那应该使您对哪里出了问题有了更好的了解.

  1. Try running make with VERBOSE=1 to increase the output on the makefile. That should give you a better idea of what is wrong.

尝试使用cmake-gui运行,然后打开高级模式以检查针对不同Qt5依赖项找到的CMake.在Mac上,我将最新的Qt安装到我的主目录中,这导致我不得不手动设置变量.这就是我的样子.

Try running with cmake-gui, then turn on advanced mode to check out what CMake found for the different Qt5 dependencies. On Mac, I install the latest Qt to my home directory, causing me to have to manually set variables. This is what it looks like for me.

希望这提供了一些有用的信息.

Hopefully this provides some useful information.

这篇关于为Qt编译OpenCV时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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