ubuntu下QT环境配置全过程(包括qt library安装和qt creator安装)

(一)QT安装(Qt Library)

step1:进入qt下载镜像链接http://download.qt.io/archive/qt/4.8/4.8.6/,选择合适的版本下载我这里选择的是qt-everywhere-opensource-src-4.8.6.tar.gz

step2:拷贝到自己待安装的文件夹下,解压:


tar zxvf qt-everywhere-opensource-src-4.8.6.tar.gz

step3:进入解压后的目录,执行configure配置

cd qt-everywhere-opensource-src-4.8.6/
./configure

此处也可以加上配置前缀./configure -prefix /opt/qt-4.8.6-x11

这样的话再后面编译过程中的文件会复制到/opt/qt-4.8.6-x11这个目录下(目录不存在会自动创建),好处是源码便于管理。

配置过程中会有以下提示:

Which edition of Qt do you want to use ?

Type 'c' if you want to use the Commercial Edition.
Type 'o' if you want to use the Open Source Edition.

选择o。继续提示:

This is the Open Source Edition.
You are licensed to use this software under the terms of
the Lesser GNU General Public License (LGPL) versions 2.1.
You are also licensed to use this software under the terms of
the GNU General Public License (GPL) versions 3.

Type '3' to view the GNU General Public License version 3.
Type 'L' to view the Lesser GNU General Public License version 2.1.
Type 'yes' to accept this license offer.
Type 'no' to decline this license offer.

Do you accept the terms of either license?

输入yes,回车即可。接下来就会生成makefile文件,配置过程十分钟左右。


step4:配置完毕后执行make。

make
此过程较为漫长,时间长短由电脑配置决定。笔者是固态硬盘,大概运行了40多分钟。普通硬盘可能会长达几个小时。

step5:执行sudo make install来安装。默认会安装到/usr/local/Trolltech/Qt-4.8.6目录下。若之前添加了configure参数,则会安装到qt-4.8.6-x11目录下。安装过程较短,大概几分钟。


安装完毕后,可以执行/bin/designer,若看见qt启动,说明已经安装成功。(如下图)

image

qmake和designer在同一目录下(bin)。


(二)QT creator安装

step1:下载安装文件http://www.qt.io/download-open-source/#section-2

首先得知道ubuntu是32位还是64位的:终端输入命令sudo uname --m,如果显示i686,即为32位操作系统,如果显示 x86_64,就是64位操作系统。也可以试一下在线安装。

step2:下载下安装包以后,需要修改文件的权限

终端输入命令修改文件权限: chmod u+x qt-opensource-linux-x64-5.5.1.run
终端输入命令进行运行安装: ./qt-opensource-linux-x64-5.5.1.run

然后会弹出一个图形安装界面,自定义安装位置,其他的选择默认的安装即可。


step3:配置环境


然后新建项目,测试~~

如果出现

No valid kits found

参考以下链接:http://m.blog.csdn.net/a6625138/article/details/47296283


注意:项目路径只能放在公共目录下,否则无法创建新工程,原因是权限不够,无法读写文件或文件夹。

你可能感兴趣的:(ubuntu)