Qt version in centos7

*爱你&永不变心* 提交于 2019-12-12 16:47:03

问题


I am using centos 7. To check the version of qt installed I am using the command qmake --version which returns

Qmake version: 1.07a (Qt 3.3.8b).
Qmake is free software from Trolltech ASA.

However when I give the command yum install qt, I get the message

Package 1:qt-4.8.5-13.el7.x86_64 already installed and latest version.
Nothing to do.

I am not sure which version of qt is installed in my system! I need to have a qt version > 4.7.


回答1:


Qt is designed to support multiple parallel installations. I usually have dozens on my systems - multiple versions, targets, configurations.

It's on you to select the version of qmake that represents the Qt installation you're wishing to use. There's a 1:1 mapping between a qmake binary and a Qt installation.

To find all qmake binaries on your system, you can e.g. $ locate qmake | grep bin

The version of qmake present in your PATH is of no consequence, generally speaking, since for any given project you only need to invoke qmake directly once - you do so by giving the full path to the qmake in the install of Qt you're using in the build. Subsequent invocations are done via make qmake_all. I personally find no need for qmake in the PATH at all - it's too easy to run wrong one by mistake.

To recap, for any given project, you'd do:

set CPUS=$(grep -c ^processor /proc/cpuinfo)
mkdir build-projectFoo
cd build-projectFoo
/path/to/Qt/bin/qmake ../projectFoo-src
# no need to call qmake directly from this point onwards
make -j$CPUS
... (modifications to sources, project files, etc.)
make qmake_all && make -j$CPUS



回答2:


You should check what Qt packages are installed with: # yum list qt*

This will give you the list of Qt packages actually installed on your system (and the ones available for installation). Make sure you don't have any older qt package installed.

@tambre is right, qt-4.8.5-13.el7.x86_64 is Qt 4.8.5.

You can the also use: $ whereis qmake to get the location of the qmake that is accessed via your $PATH (it will most likely be /usr/bin/qmake).

Then, check if the qmake actually installed by your package matches the previous result with: # rpm -ql qt


Are you using CentOS as a workstation (with GUI) or as a server (without GUI) ?

Because if, after the previous steps, you still get the wrong qmake, and you're using QtCreator in a you can manually set a new "Qt Version" in QtCreator linked to the qmake you want (v4.8.5).

To do that, go to QtCreator > Tools > Options...; then Build & Run > Qt Versions tab. Check if the Qt version you're looking for has already been detected automatically. If not, choose "Add" on the left, and navigate to the qmake of the wanted version.

Now check if a Kit exists for the Qt version you added (in the "Kits" tab) and if not, add a new kit linked to the Qt version you want, device type you need, etc.

You can then use this kit to configure existing projects and build then with it. To do so, go in the Projects tab in QtCreator (Ctrl+5) and select the wanted kit for your project.

D




回答3:


I edited the file .bash_profile as export QTDIR=/usr/local/Trolltech/Qt-4.8.2 export PATH=$QTDIR/bin:$PATH after removing qt3 and now its working fine.



来源:https://stackoverflow.com/questions/43716231/qt-version-in-centos7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!