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)?
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.
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.
Related
I have installed the current Qt 5.8 inside a users home directory and now try to use it since three days. Cmake always uses the system wide Qt installation and kdevelop does the same. No CodeCompletion on the new stuff and so on...
I tried to install it system wide in /opt/Qt but nothing changed.
So can please anyone tell me what environment variables do I have to change to integrate the current Qt Version in my Development System?
Many Thanks
By the way - it is a kdevelop 5.0 running on a Debian Linux testing
From cmake does not find qt 5.1.1 question:
You need to set the CMAKE_MODULE_PATH to the Qt installation where the *.cmake files are located. This CMake variable is used to select which Qt installation to use for compiling. There is also a`CMAKE_PREFIX_PATH environment variable.
See http://doc.qt.io/qt-5/cmake-manual.html
The code completion: in project settings add to include paths something like:
/.../.../5.8/gcc_64/include/QtGui/
/.../.../5.8/gcc_64/include/QtCore/
/.../.../5.8/gcc_64/include/QtQuick/
...
Edit: The following is only correct for Qt4 and not for Qt5!
The default qt version found by cmake is the one assoziated with the qmake binary in your $PATH. Run which qmake in order to find out which one it is. It will probably be the system-wide one. The fastest way to coerce cmake into finding your custom version is then adding your Qt's bin folder to the $PATH as the first entry and running kdevelop from that command line: PATH=/opt/Qt/5.8/bin:$PATH kdevelop. Code completion should then also work, as AFAIK kdevelop uses the include folders evaluated by cmake for code completion.
You might want to consider switching to QtCreator, which fixes this problem by listing all Qt versions as "Kits" which you can select in the project settings.
I've been trying to import an open-source project into Qt-Creator to read the code and to learn from it by debuging. Unfortunatly I cannot build imported projects. I found two interessting projects:
https://sourceforge.net/projects/qpass/files/source/
and
https://github.com/keepassx/keepassx
I imported them into Qt Creator by File-->New File or Project-->Import Project-->Import as qmake Project (Limited Functionality). Afterwards I tried to run the project and I got an error:
G:\Qt Projekte\keepassx-2.0.3\src\autotype\test\AutoTypeTest.h:23: Fehler: autotype/AutoTypePlatformPlugin.h: No such file or directory
The file is definitely existing and it's within the project. I googled it and found that there might be problem when importing Qt4 projects into Qt5. Some user recommended to insert 'Qt += widgets' into the pro-File. But it didn't solve my problem.
Does anybody have an idea how to fix it? Is the way how I am importing projects into Qt Creator wrong?
Instead of "New File or Project", you want to use "Open File or Project". Since both projects use cmake, you should be opening their topmost CMakeLists.txt file. I've verified that both of the projects open that way on OS X with Qt/Creator from macports and build successfully using either the default CodeBlocks - Unix Makefiles CMake Generator, or CodeBlocks - Ninja.
Here are the things I had to do to get the builds going:
Add the macports binary path (/opt/local/bin) to the system environment in the project's build settings. That's so that cmake would find ninja. This is optional if you don't use ninja, but ninja speeds up builds by a good integer factors so it's recommended over make.
Add the /opt/local/include path to the INCLUDE_DIR path in QPass's CMakeLists.txt: otherwise it wouldn't find gcrypt's include files from macports. That wouldn't be a problem on most linux distributions, but you'd need a similar fix on windows.
I downloaded Qt5.6 VS2013 32bit and try to run the official example of QtWebEngine.
I just followed the instruction but
When linking it gives out an error of
LNK1104 file not found c:\Users\qt\work\install\lib\Qt5Widgetsd.lib.
However, I have no idea of where this path c:\Users\qt\work\install\lib\ comes from.
I did text search in all directories of example folder and no hits other than generated files(makefiles and pdbs).
I also checked system environment variables but no hits.
Furthermore, I checked Qt Creator'r Projects panel and its Build Environment and still no hits.
Did I miss something?
P.S. this error was given out by linking DemoBrowser example of QtWebEngineWidgets pro
The link is generated by qmake when it generates the build scrip from the qt project file (*.pro). It is based from the qmake application path that is generaly installed together with the libraries (check you qt kit setup to change it if needed: Jst browse to qmake.exe application).
Then try regenerate the build script. It should fix the issue.
You may also have issue with installation not being in debug mode; you are trying to use Qt5Widgetsd.lib library instead of the non-debug one Qt5Widgets.lib
I installed Qt SDK (Qt framework + Qt Creator) but didn't like the layout of folders so I deleted it (without uninstalling), moved framework in one place and Qt Creator in another and installed Qt framework and Qt Creator separately placing each over the respective old one.
The problem is Qt Creator in Projects/Build Settings/Build Steps keeps showing the old path to the specification file:
-spec c:/qt/2009.03/qt/mkspecs/win32-g++
Setting QMAKESPEC environment variable either in the system or in Projects/Build Environment doesn't change anything.
How can I force Qt Creator to see and use new location of the specification file?
This does not fully solve the issue but if you add '-spec' (without quotes) in the additional arguments box in build steps -> qmake, then it removes the win32-g++ argument.
NOTE: I have NOT been able to build the project after doing this (i changed it to win32-icc and win32-msvc2008 as i have both the intel c++ compiler and VS2008) but the build fails with the error ---- "*** MIssing Separator. Stop." in the makefile
I don't have Qt Creator installed, but I suppose it may store this setting somewhere on filesystem, look in your %HOME% or %APPDATA% for directories associated with Qt Creator and search the files inside for this path.
Have you tried going into Projects->Build Settings->General and clicking on the "Manage Qt Versions" and making sure that everything there is all correct?
I am new to qmake and I am trying to build an existing application. Qt was originally installed in /usr/local/lib/Qt-4.3.5 and 'qmake -query QT_INSTALL_PREFIX' returns that path.
I have moved the Qt library to another location and the generated Makefiles are peppered with the /usr/local original path.
How can I force qmake to use the new location I selected without recompiling Qt?
I was looking into this and found a way that works (in qt 4.7.2) by customizing qt with a qt.conf file.
In my case, I added a qt4-4.7.2/bin/qt.conf (It must be in the same place as the qmake executable)
With the following contents:
[Paths]
Prefix = c:/my_path/to/qt4-4.7.2
and the qmake -query started returning the proper paths!
See: http://doc.qt.io/qt-4.8/qt-conf.html for more details
[Update:] Since at least Qt 5.3.1 (tested with static versions of 5.3.1 and 5.5 on Windows 8) you can simply do
[Paths]
Prefix = ..
and deploy the Qt installation anywhere.
This is a 'builtin' compiled into qmake from qconfig.cpp. The best way is to reconfigure Qt with another -prefix and rebuild unfortunately. For most other variables, you can use a .qmake.cache file. See
http://doc.qt.digia.com/qt/qmake-environment-reference.html
for more info
As pointed out by Henrik Hartz, QT_INSTALL_PREFIX is built-in and can't be changed. However, if you just want to work around having to rebuild Qt temporarily, then you can try the following:
Query qmake for it's install prefix, recreate the reported directory structure, and use a symlink or hardlink to where the relocated Qt version is. E.g. on Linux
Get the path reported by /new/Qt/location/bin/qmake -query QT_INSTALL_PREFIX. Say this reports /Parent/Dirs/Prefix.
Create any parent directories of the path, e.g. mkdir -p /Parent/Dirs/
Symlink to new location, e.g. ln -s /new/Qt/location /Parent/Dirs/Prefix
The above can be also useful if you have a bunch of developers who need to work with the same prebuilt version of Qt, where this Qt version isn't necessarily copied to the same path on all the developers' computers, and where you only need to bundle the Qt shared libs with you application for end users (i.e. you won't be shipping headers or build tools).