Build the Qt development environment in Linux
I have been using Qt4 In the Ubuntu software center to develop Qt applications. Now I want to go to Linux for Qt5 development. However, I have to download the corresponding installation package from the official Qt website, which is relatively difficult to configure, the entire development process is described here.
First of all, on the official website can find the offline installation package, the latest for the qt-opensource-linux-x86-5.4.1.run, this is an executable file, after downloading can modify permissions directly run. In addition, you can also find the source code compressed package on the official website. Because this is an open-source GUI class library, you can download all the source code and compile and install it on your own machine.
Here I will first introduce how to directly use the installation package. After downloading the installation package, you must first modify the running permission of the executable file.
$: chmod u+x qt-opensource-linux-x86-5.4.1.run$: ./qt-opensource-linux-x86-5.4.1.run
After running this program, a graphical installation interface will pop up. You need to select the installation location. Here I set it to/usr/local/Qt5.4.1/. You can choose the default installation mode for others. You only need to wait for the installation to complete.
After the installation is complete, you can start the Qt Creator application and write a test program. However, you may encounter the following error message:
/usr/bin/ld: cannot find -IGL
It means that the OpenGL library is not supported. Therefore, you need to install the relevant OpenGL package and execute the following command:
$: sudo apt-get install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev
After installation, You can compile the test program correctly.
However, when we call the qmake-v command in the command line form on the terminal to view the qmake version, the system prompts that the corresponding program cannot be found. This is because we have not configured the environment variables of the Software. We only need to edit the corresponding. bashrc file under the Home Directory of the current user:
$: cd$: vim .bashrc
Then, add the following statement at the end of the file:
export PATH="/usr/local/Qt5.4.1/5.4/gcc/bin":$PATH
After editing, save and exit. Then run the following command:
$: source .bashrc$: qmake -vQMake version 3.0Using Qt version 5.4.1 in /usr/local/Qt5.4.1/5.4/gcc/lib
We can see the qmake version number and the complete path of the program.
Install and configure Gtk and QT compiling environments in Ubuntu
Build a QT environment in Linux
Solution for failure to run the QT console program in Ubuntu and how to configure XTerm
How to port QT4.7.4 in Ubuntu 10.04
Install and deploy the Qt5 development environment in Ubuntu 14.04
Qt details: click here
Qt: click here
This article permanently updates the link address: