【ubuntu】在ubuntu上安装QT

(1)在64位的ubuntu中安装QT

(1.1)下载QT  如:qt-opensource-linux-x64-5.10.1.run

QT网址1

QT网址2

(1.2)安装QT

chmod +x qt-opensource-linux-x64-5.10.1.run

./qt-opensource-linux-x64-5.10.1.run

(1.3)安装的时候如果空间足够大可以把选项qt跟tools都选上。

(1.4)安装成功后配置环境

安装gcc g++
sudo apt-get install g++
安装IGL

sudo apt-get install libglu1-mesa-dev -y

sudo apt-get install build-essential

安装完了之后要关闭QT在打开才可以。

(2)在32位的ubuntu上安装QT。注:现在很多高版本的QT的run文件基本上都是64位的,没有32位。

(2.1)如果对版本没有什么大的要求:

https://www1.qt.io/download-open-source/?hsCtaTracking=f977210e-de67-475f-a32b-65cec207fd03|d62710cd-e1db-46aa-8d4d-2f1c1ffdacea#section-2

找到并下载:

Qt Online Installers--》Qt Online Installer for Linux 32-bit (33 MB)   (info)

上面的是需要联网才可以安装的。

安装完成后配置跟(1.4)一致

(2.2)如果要求版本QT是很高的。则需要分别安装QT跟QT-CREATOR源码:


(2.2.1)下载安装qt源码:在网址:https://download.qt.io/official_releases/qt/5.10/5.10.1/single/

中下载(建议不要下载zip的,因为下载下来老是报错,不知什么原因):

qt-everywhere-src-5.10.1.tar.xz

下载解压:

xz -d qt-everywhere-src-5.10.1.tar.xz

tar xvf ./qt-everywhere-src-5.10.1.tar

/configure

make 

sudo make install

接下来编辑环境

gedit ~/.profile

在profile里增加指向qmake的PATH

if [ -d "/usr/local/Qt-5.10.1/bin" ] ; then
    PATH="$PATH:/usr/local/Qt-5.10.1/bin"

fi

(2.2.2)安装qt-creator源码:

安装Qtcreator:

在https://mirrors.tuna.tsinghua.edu.cn/qt/official_releases/qtcreator/4.6/4.6.1/qt-creator-opensource-src-4.6.1.tar.xz

下载qtcreator,解压缩

在编译qtcreator之前,为了让刚才安装的qt 5.10.1起作用,编辑 /usr/lib/i386-linux-gnu/qt-default/qtchooser/default.conf,改为以下内容

/usr/local/Qt-5.10.1/bin
/usr/local/Qt-5.10.1
#/usr/lib/i386-linux-gnu/qt4/bin
#/usr/lib/i386-linux-gnu

回到qtcreator源码目录(这个目录下有 qtcreator.pro和README.md)

qmake -r
make
sudo make install

现在可以在命令行上执行qtcreator了。

但是现在qtcreator里还没有帮助。

回到qt源码目录和qtcreator源码目录,分别执行

make docs

sudo make install_docs

然后在qtcreator里,工具->选项->帮助->文档->添加,在/usr/local/Qt-5.10.1/doc 和 /share/doc/qtcreator,把能找到的qch文件都包含进去。

这时候创建qt工程还是会出错。在qtcreator里,工具->选项->构建和运行->构建套件(kit),找到Qt版本,选中Qt5.10.1。

该部分转自:

https://blog.csdn.net/whatnamecaniuse/article/details/80511064




猜你喜欢

转载自blog.csdn.net/ipfpm/article/details/80698659