同时安装qt4,qt5后发现默认是qt5,qt4项目不能编译。经过which qmake,知道qmake 命令在/usr/bin/qmake,这个文件连接到/user/bin/qchooser
猜测这个chooser是个进行版本管理的工具,。。
其用法以下:
Usage:
qtchooser { -l | -list-versions | -print-env }
qtchooser -run-tool= [-qt=] [program arguments]
[-qt=] [program arguments]
Environment variables accepted:
QTCHOOSER_RUNTOOL name of the tool to be run (same as the -run-tool argument)
QT_SELECT version of Qt to be run (same as the -qt argument) linux
cd /usr/lib/x86_64-linux-gnu/qtchooser/ 工具
r$ llspa
总用量 72rem
drwxr-xr-x 2 root root 4096 11月 30 22:12 ./qt
drwxr-xr-x 96 root root 69632 11月 30 22:13 ../io
lrwxrwxrwx 1 root root 50 11月 27 20:58 4.conf -> ../../../share/qtchooser/qt4-x86_64-linux-gnu.conf编译
lrwxrwxrwx 1 root root 50 11月 27 20:58 5.conf -> ../../../share/qtchooser/qt5-x86_64-linux-gnu.conf版本管理
lrwxrwxrwx 1 root root 50 5月 28 2015 default.conf -> ../../../share/qtchooser/qt5-x86_64-linux-gnu.confim
lrwxrwxrwx 1 root root 50 11月 27 20:58 qt4.conf -> ../../../share/qtchooser/qt4-x86_64-linux-gnu.conf项目
lrwxrwxrwx 1 root root 50 11月 27 20:58 qt5.conf -> ../../../share/qtchooser/qt5-x86_64-linux-gnu.conf
经过下面两条命令就能够把默认qt切换到qt4
sudo remove default.conf
sudo ln -s /usr/share/qtchooser/qt4-x86_64-linux-gnu.conf default.conf
或将default.conf中
/usr/lib/x86_64-linux-gnu/qt5/bin
改成
/usr/lib/x86_64-linux-gnu/qt4/bin
若要改回qt5则再该回来。