Lorenzo Monni
Lorenzo Monni

Reputation: 113

Error in OpenCV configuration for Qt Creator

I followed these instructions in the configuration of OpenCV SDK for using it in Qt Creator IDE, but I couldn't conclude point 6.5, due to configuration errors in Cmake-GUI. I setup the configuration in CMake of the compilers gcc and g++ contained in Qt folder for MinGW32, and all looks Ok. But when Cmake-GUI starts the process of build configuration it ends up saying

"Error in configuration process, project files may be invalid".

It can't find the following:

  • QT_QMAKE_EXECUTABLE;
  • Qt5Concurrent_DIR;
  • QT5Core_DIR;
  • QT5Gui_DIR;
  • QT5Test_DIR;
  • QT5Widgets_DIR.

After this issue I tried to go on with following points of configuration tutorial, without reaching the final instruction of mingw32-make install. I'm using the following versions of softwares: Qt 5.3.0, OpenCV 2.4.9, CMake 2.8.12.2. My OS is Windows 7.

How can I recover the missing Qt files in CMake configuration? Is there an alternative way for configuring OpenCV with Qt (like using precompiled build of OpenCV libraries)?

Upvotes: 3

Views: 5878

Answers (2)

usr1234567
usr1234567

Reputation: 23384

You have to specify the location of Qt manually by passing it as an argument for QT5Core_DIR. Qt5_DIR or CMAKE_PREFIX_PATH does also the trick.

Example
Given your Qt 5 is installed at /opt/selfcompiled/Qt5. When calling cmake, add the flag from above:

cmake -DQt5_DIR=/opt/selfcompiled/Qt5 <pathToSourceDir>

Once the Qt 5 directory is set and found by CMake, all the other variables related to Qt 5 should be found from there, too.

Upvotes: 0

SergioMP
SergioMP

Reputation: 81

You just need to indicate CMake the correct paths to each one. Click oh the path to browse and set each one individually:

  • QT_QMAKE_EXECUTABLE; For this one, you need to search inside the Qt installation folder for the /bin directory. On it, you' ll find the qmake.exe. In my case it was C:/Qt/5.3/winrt_x64/bin/qmake.exe

    All the following ones are in the Qt's /lib/cmake directory. In my case: C:/Qt/5.3/winrt_x64/lib/cmake :

  • Qt5Concurrent_DIR;
    C:/Qt/5.3/winrt_x64/lib/cmake/Qt5Concurrent

  • QT5Core_DIR;
    C:/Qt/5.3/winrt_x64/lib/cmake/Qt5Core

  • QT5Gui_DIR;
    C:/Qt/5.3/winrt_x64/lib/cmake/Qt5Gui

  • QT5Test_DIR;
    C:/Qt/5.3/winrt_x64/lib/cmake/Qt5Test

  • QT5Widgets_DIR.
    C:/Qt/5.3/winrt_x64/lib/cmake/Qt5Widgets

Then click generate. It' ll show a new error and ask you for the QT5OpenGL_DIR. Just as before, show CMake the correct directory. In my case: C:/Qt/5.3/winrt_x64/lib/cmake/Qt5OpenGL. Finally, click Configure again, and then Generate, and now you're done creating the build files.

Upvotes: 8

Related Questions