Install QT and related environment configuration under Linux Ubuntu system

Install QT

       Download the QT installation package from the official website and install it locally. This time, Ubuntu18.06 and QT5.14.2 are used, and this version is used as an example below.

       First install QT, the specific operation is as follows: 

1. Use the cd command: cd /home/(usr)/download to switch to the directory where the installation package is located.
2. Use the command: sudo chmod +x qt-opensource-linux-x64-5.14.2.run to obtain the permission to open the installation package. Since it is the super command sudo, you need to enter the user password here, and it will not be displayed when you enter it. Just press Enter after finishing.
3. Use the command: ./qt-opensource-linux-x64-5.12.0.run  to run the installation package.
4. The QT graphical installation interface will pop up here. For registered users, it is not recommended to change the installation directory. In the installation options, if the external storage is sufficient, you can tick all of them. Here, choose to install gcc_64 (required) and Android related (optional), check QtCreator in Tools, and the next step is to install.
5. After the installation is complete, do not open qt creator, and then you need to configure the relevant environment.

 Configure the QT environment

       Next, open the terminal and configure the QT environment.

1. Use the command: sudo apt-get install gcc g++  to install gcc and g++. After the installation is complete, you can enter gcc -v and g++ -v to check whether the version number appears to confirm that the installation is successful.
2. Use the command: sudo apt-get install build-essential to install the compilation tool.
3. Use the command: sudo apt-get install vim to install vim.
4. Change user system variables: first use the command: sudo gedit /home/(usr)/.bashrc, then enter at the end of the file:

export QTDIR=/home/(usr)/Qt5.14.2/5.14.2/gcc_64

export PATH=$QTDIR/bin:$PATH

export MANPATH=$QTDIR/man:$MANPATH

export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH

5. Change system variables: first use the command: sudo gedit /etc/profile, then enter at the end of the file:

export QTDIR=/home/(usr)/Qt5.14.2/5.14.2/gcc_64

export PATH=$QTDIR/bin:$PATH

export MANPATH=$QTDIR/man:$MANPATH

export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH

6. After the changes in 4 and 5 above are completed, use the command: source ~/.bashrc to make the changes take effect.

7. Enter the command in the terminal: qmake -v to test whether the environment variable is modified successfully. Displays the qmake version number if successful.

Guess you like

Origin blog.csdn.net/weixin_56675362/article/details/129306603
Recommended