0

On my Ubuntu machine, I have a version of Qt installed. This was installed a while ago, and I cannot remember how I installed it. But if I run apt list --installed from the command line, there are several packages listed related to qt, such as qtcreator/xenial,now 3.5.1+dfsg-2ubuntu2 amd64, qtcreator-data/xenial,xenial,now 3.5.1+dfsg-2ubuntu2 all, qttools5-dev-tools/xenial-updates,now 5.5.1-3ubuntu0.1 amd64, etc.

I now want to update my version of Qt. So, I visited the Qt website and downloaded the latest version, which cam as a .run file. Running this file installed the new version of Qt into a directory of my choice. This directory is /home/John/Libraries/Qt-5.9. I didn't do anything after running the .run file, but I was able to load the new version of Qt Creator by executing one of the binary files.

However, if I run qmake --version from the command line, it prints out Using Qt version 5.5.1 in /usr/lib/x86_64-linux-gnu. Therefore, it seems that my system is still using the old version of Qt by default.

How can I ensure that my system uses the new version when linking with other projets?

Karnivaurus
  • 1,024
  • 3
  • 15
  • 34

2 Answers2

0

Test if :

sh -c "$(find /home/John/Libraries/Qt-5.9 -iname 'qmake' | grep gcc) -v" 

gives you the updated version, if so update the link in qmake command with

ln -sf $(find /home/John/Libraries/Qt-5.9 -iname 'qmake' | grep gcc) $(which qmake)
NetIceGear
  • 641
  • 3
  • 8
0

You can use qtchooser to configure this. This should already be installed on your system as you have previously installed a version of Qt from the repositories. Note: the configuration below will effect only the current user.

Configuration

Create a folder named qtchooser in the location ~/.config/.

Create a text file in this new folder named default.conf with the following contents:

{path-to-your-Qt-installation-folder}/gcc_64/bin
{path-to-your-Qt-installation-folder}/gcc_64/lib

The first line in the file is the path to the Qt binaries and the second is the path to the Qt libraries.

Check the Configuration

qmake -v

If the configuration is working correctly, you should see the later Qt version reported.

Important Note

If you intend to develop using Qt Creator you don't need to configure the system as above. Qt Creator can be configured to use multiple Qt versions. This is done in the Tools->Options menu under the Kits tab. You can then choose the Kit you wish to use within each project.

gsxruk
  • 1,380