同時安裝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則再該回來。