同时安装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)
cd /usr/lib/x86_64-linux-gnu/qtchooser/
r$ ll
总用量 72
drwxr-xr-x 2 root root 4096 11月 30 22:12 ./
drwxr-xr-x 96 root root 69632 11月 30 22:13 ../
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.conf
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则再该回来。