I am trying to install Jom (http://wiki.qt.io/Jom) for C++. When I type in qmake -r in cmd, I get the error Project MESSAGE: Cannot build jom with Qt version 4.8.7. Project ERROR: Use at least Qt 5.2.0.. This is because I have PyQt version 4.8.7 and Qt version 5.8.0 both installed. When building Jom, Jom searches for in the wrong Qt folder. How can I fix this?
If you have multiple version of Qt installed, you also have multiple version of qmake. You can check which qmake you are running by using where qmake on Windows, it will output a list of qmake executable available in your path, the first one in the list will be the one executed when running qmake.
For instance:
C:\>where qmake
C:\Qt\5.8\msvc2015\bin\qmake.exe
C:\Qt\5.6\msvc2015\bin\qmake.exe
If the first one, is not the one you want, you can run it by using its complete path:
C:\>C:\Qt\5.6\msvc2015\bin\qmake.exe -version
QMake version 3.0
Using Qt version 5.6.2 in C:/Qt/5.6/msvc2015/lib
If the qmake and Qt version you want is not in your PATH, you can use the scripts provided by Qt to setup a valid environment. These are available in the Start menu as Qt 5.8 64-bit for Desktop (MSVC 2015) (change according to your installation), or you can use them directly by executing qtenv2.bat (e.g C:\Qt\5.8\msvc2015\bin\qtenv2.bat).
If you are using MinGW you are all set, but if you are using MSVC you need also to run vcvarsall.bat, which can be found in your Visual installation folder.
Related
I have a project I made with Qt 5.7 in QtCreator, but now I would like to be able to build the project with qmake in the terminal rather than through QtCreator. However, I can't get qmake to run with Qt 5.7.
Following the instructions in this webpage, I can switch qmake to qt5 but qmake -v still says I'm running QT 5.2.1. How can I switch this to Qt 5.7?
Edit: Adrien's second comment worked. I was unable to get qmake to switch to Qt 5.7, but I can simply directly call the qmake that came installed with Qt 5.7 like this:
/home/<user>/Qt5.7/Qt5.7.0/gcc<something>/bin/qmake
Short answer: yes of course :)
Each Qt build builds its own qmake binary. So if you already built/installed Qt 5.7, it means you are simply pointing to your previous Qt version's qmake. You can access any Qt version qmake executable from your Qt install folder, i.e. for Linux:
/home/<user_name>/Qt/Qt<version>/<compiler>/bin/qmake
Note that the path to Qtfolder, and its name may vary depending on the settings you used for the first installation.
If you want to use a global setting instead, and if qtchooser -list-versions lists the Qt version you want to use, then make sure to set export QT_SELECT=<Qt version> (without spaces) in the same terminal as the one you use qmake from afterward. Environment variables are not kept when you close your terminal, or shared between different terminals.
export QT_SELECT=qt5
qmake
I mistakenly updated my qt version from 4.8.5 to 4.8.6. This happened as a result of python anaconda installation.
However I am working on a project that needs qt 4.8.5.
Running qmake -v shows:
$ qmake -v
QMake version 2.01a
Using Qt version 4.8.6 in home/<username>/anaconda/lib
How do I switch to my previous qt version (installed in the default directory, i.e. /usr/... )?
qtchooser lists the following options:
$ qtchooser -list-versions
4
5
default
qt4-i386-linux-gnu
qt4-x86_64-linux-gnu
qt4
qt5-x86_64-linux-gnu
qt5
But trying export QT_SELECT with every option didn't change the message:
Using Qt version 4.8.6 in home/<username>/anaconda/lib
I will greatly appreciate your help.
You can easily use several versions of Qt. All you need to do is - call qmake, that comes with the needed version. For example:
/usr/local/Trolltech/Qt-4.8.5/bin/qmake -v
When using QtCreator, you can add Qt version in Tools/Options.../Build & Run and switch between Qt versions in project's settings (some versions on QtCreator will require creating a Kit also, which is not very hard).
The only problem I faced is - using cmake (hate this piece of garbage). In this case you'll need to change the order in which qmake of different versions are called. First of all, find out where your default qmake is located (which qmake), then - whether it is a symlink or not (it is strange, that Qt, installed in your home directory is called without using full path). If it is a link, then change it from one Qt's version to another. If not - examine echo $PATH. What you can do: you can create a symlink for Qt4.8.5's qmake to a directory, which is previous to one, in which Qt4.8.6's qmake is. Or you can add path to it in your $PATH in the first position (sudo nano /etc/environment. Important - in some OS /etc/environment will be empty. In this case you need to write whole $PATH there, like echo PATH=\"/usr/local/Trolltech/Qt-4.8.5/bin:$PATH\" > /etc/environment).
I want to compile the qwt library using qt 5.3. Previously I had older versions of Qt. So, when I call the Qt 5.3.0 32-bit for Desktop (MSVC 2012 OpenGL) shell and move to the directory, which contains qwt (C:\qwt-6.1.0), then perform qmake qwt.pro I get this error:
Cannot read c:/Qt/Qt5.0.2/mkspecs/win32-msvc2010/qmake.conf: The system cannot find
the path specified. Could not read qmake configuration
file c:/Qt/Qt5.0.2/mkspecs/win32-msvc2010/qmake.conf.
Error processing project file: C:\qwt-6.1.0\qwt.pro
Calling:
qmake -set QMAKESPEC "C:\Qt_5.3\5.3\msvc2012_opengl\mkspecs\win32-msvc2012\"
Does not help.
PS. Solution is found! I've tried not to do like is in qwt tutorial, simple open *.pro file by Qt Creator. After this just "build" and everything was done. Without console
Because I am not a Java enthusiast, I decided to use C++ and Qt for one of my projects. However, I came across the big cross-compiling Qt problem, and I am unable to produce an .exe file for Windows users.
My setup
Linux Ubuntu 12.04, with Wine and Qt. qmake -v gives the following output :
QMake version 2.01a
Using Qt version 4.8.1 in /usr/lib/x86_64-linux-gnu
I also have a MinGW32 compiler, which can be found at /usr/bin/i586-mingw32msvc-g++. My Wine drive_c folder contains the following Qt directories :
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/Src
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32
The mingw48_32 directory contains the necessary include/ and lib/ directories, which are used in my mkspec file, /usr/share/qt4/mkspecs/win32-x-g++/qmake.conf :
QMAKE_INCDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/include
QMAKE_LIBDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/lib
The problem
According to most guides I've found about Qt cross-compiling, my setup should be enough to run a simple :
qmake -spec win32-x-g++
make
wine /path/to/my/application.exe
But... nothing's linked. QApplication and every other symbol I use in my program are "not found". No QApplication, no QPushButton, no connect(), no SIGNAL(), no SLOT()...
My objective here is to successfully configure QtCreator to use this setup (in an independent build configuration), so that it can build a Linux executable (through the first and working configuration), and a Win32 .exe (through the MinGW setup above). However, I cannot modify a single build step in QtCreator :
Cannot add a "MinGW" toolchain : it is not available in the "Add" dropdown list.
Cannot change the -spec parameter value in the project build configurations panel. The field is non-editable.
Despite guides and solutions I found all over the Internet, my only solution so far is to send my source code to a virtual Windows machine, and have it create a new project with it. On this VM, I could probably compile for Windows... But of course, this doesn't actually sound like a real "solution" to me...
Is there any way Qt(Creator) has finally made cross-compiling easier now ? I'm getting a bit tired of "symbol not found" errors...
First,
sudo apt-get install mingw-w64
Then, check if Qt Creator finds the toolchain.
Next, until Ubuntu starts providing a mingw-w64-qt package, download the Qt source and build it. This is bound to get messy, and maybe even the simplest thing to do is to install WINE and use a Windows Qt version.
Trying to move a Qt 4.6.3 project from Windows to Debian Linux (Etch). I've installed Qt by downloading the latest version, then running configure, then make install as root. Yet when I run qmake_qt4 on my project's pri file, here's what I get:
uic: File generated with too old version of Qt Designer
Running uic -v returns 4.2.1. How come? Wasn't make install supposed to put the latest Qt on the system?
By default, Qt installs to /usr/local/Trolltech/Qt-4.6.3 and doesn't add it's bin folder to your PATH variable. Also, it's just named qmake.
Either call /usr/local/Trolltech/Qt-4.6.3/bin/qmake using the complete path or add the /usr/local/Trolltech/Qt-4.6.3/bin/ path to your PATH variable and ensure that it is listed there before any other path that may have a qmake. Best thing to do is to uninstall the the debian qt version if you don't need it elsewhere.