QT CREATOR+OPENCV2.4.2+MINGW Development environment configuration under windows

Source: Internet
Author: User

Due to the project development reasons, the need to configure the QT CREATOR+OPENCV2.4.2+MINGW development environment, the configuration method is summarized as follows:

1. Download the software Prerequisites

    • QT SDK for Open Source C + + development on Windows (search the official website on Google to find it)
    • OpenCV 2.4.2: The latest OpenCV version, after the installation of the directory has the source code and a version of the Lib and DLL, but to avoid problems, or compile it yourself.

Http://sourceforge.net/projects/opencvlibrary/files/opencv-win

    • Cmake 2.8.9

Google can find the download link.

2. Installing the software

To install the QT SDK:

Installation will pop up an error prompt window, has not been understood, directly ignore the past, as if there is no impact. It is important to note that the QT new project is a choice of desktop development options rather than the Symbian development option. After the project has been completed, in the "project" that compiler selected: MinGW4.4. Also, recompile OpenCV to use MinGW4.4 compilation. put "<qt_directory>\mingw\bin" Add to environment variable PATH the.

Note that <Qt_directory> for the post-installation QT directory where the name of the environment variable is to be set to Path , if the value of the variable already has a different path, you can add the English semicolon after the path ( ; ) , you can then add a new path, such as E:\software\QT\mingw\bin .

If you do not correctly add "<qt_directory>\mingw\bin" to the environment variable path, you will get an error when compiling OPENCV source code with CMake below.

3. compiling OpenCV

The main references are the following English articles:

Steps to build OpenCV 2.3.1 with Qt and MinGW:

1. Install Qt SDK with the C + + compiler option (MinGW). You can download it here.

2. Add "D:\QtSDK\mingw\bin" to the system PATH.

3. Download and install CMake (2.8.5).

4. Download and install OpenCV2.3.1 (opencv-2.3.1-win-superpack.exe).

5. Run CMake GUI.

6. Set The source code: "D:\OPENCV2.3.1_SRC"

7. Set where to build binaries to: "D:\OpenCV2.3.1_out".

8. Press Configure

9. Let CMake create the new folder.

Specify the Generator:mingw makefiles.

One. Select "Specify Native Compilers" and click Next.

For C set: "D:\QtSDK\mingw\bin\gcc.exe"

For C + + set: "D:\qtsdk\mingw\bin\g++.exe"

Click Finish

In the configuration, screen type, "DEBUG" (or "release" If you want to build a RELEASE version) for Cmake_build_type . Check Build_examples if you want. Check WITH_QT.

Click configure again.

The Configure screen would make you specify the "Cuda_toolkit_root_dir" path.

Set Cuda_toolkit_root_dir to: "D:/qtsdk/desktop/qt/4.7.3/mingw/bin"

Click configure again. Click Generate. Close CMake.

Go to "D:\OpenCV2.3.1_out" DIR and type "Mingw32-make" and hit enter (this might take some time).

Run diagram

Then the type "Mingw32-make install" and hit enter again.

Work done

=====================================================

Use:

ADD:

Includepath+=d:/opencv2.3.1/include

Libs+=d:/opencv2.3.1/bin/*.dll

Or

Includepath+=e:\opencv-2.3.1\mingw\install\include

Libs+=d:\opencv2.3.1\lib\libopencv_core231d.dll.a\

D:\OpenCV2.3.1\lib\libopencv_highgui231d.dll.a\

D:\OpenCV2.3.1\lib\libopencv_imgproc231d.dll.a\

D:\OpenCV2.3.1\lib\libopencv_ml231.dll.a

To Qt's "pro" file, then the can work on.

Wait for the compilation, after the end of the necessary things are in the install folder inside. Add the <build_directory>\install\bin to the environment variable path, for example E:\software\OpenCV2.4.2\opencv\MinGW\install\bin;

    1. 1. Qt Creator configuration OpenCV

Just modify the. Pro file to add include and Lib. For example:

That's it!

QT CREATOR+OPENCV2.4.2+MINGW under Windows Development environment configuration

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.