Windows上带有Qt Creator的OpenCV 2.1 [英] OpenCV 2.1 with Qt Creator on Windows

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

问题描述

我在Windows上安装了OpenCV 2.1和Qt(创建器).
使用OpenCV C API,我可以使用OpenCV在Qt中链接,构建和运行应用程序.
但是,当使用OpenCV C ++ API时,出现链接问题.
这可能是由于C ++ ABI 问题造成的,因为我使用的是预构建的二进制文件(已构建Windows的MSVC-2008中使用),而Qt Creator使用MinGW.
如何配置CMake来重建OpenCV 2.1,以使生成的.lib与Qt兼容?
谢谢!

I have OpenCV 2.1 and Qt (Creator) installed on Windows.
Using the OpenCV C API I can link, build and run apps in Qt using OpenCV.
However, the when using the OpenCV C++ API, I am getting linking problems.
This is probably due to C++ ABI problems, since I'm using the pre-built binaries (built with MSVC-2008) for Windows and Qt Creator uses MinGW.
How do I configure CMake to rebuild OpenCV 2.1 so that the resulting .libs are compatible with Qt?
Thanks!

推荐答案

您需要确保CMake将找到用于编译Qt的同一MinGW.如果下载了QtCreator捆绑软件,则Qt安装目录中应该有一个mingw目录.确保此目录位于您的路径中,并且将使用正确版本的MinGW(例如,使用命令"which").另一种选择是配置CMake变量CMAKE_CXX_COMPILER,使其指向mingw目录中的正确可执行文件.

You need to make sure that CMake will find the same MinGW that was used to compile Qt. If you downloaded the QtCreator bundle, you should have a mingw directory in Qt installation directory. Make sure that this directory is in your path and that the correct version of MinGW will be used (for example using the command "which"). Another alternative is to configure the CMake variable CMAKE_CXX_COMPILER so that it points to the correct executable in the mingw directory.

在那之后,您要做的就是在OpenCV文件夹中运行CMake,告诉它生成生成的MinGW makefile,然后运行make,就可以了(希望如此)!

After that, all you need to do is run CMake in your OpenCV folder, telling it to generated MinGW makefiles, then run make and you're done (hopefully)!

这篇关于Windows上带有Qt Creator的OpenCV 2.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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