1、下载Qt Creator

      链接  http://qt-project.org/downloads 

      选择 Qt Creator 2.8.0 for Linux/X11 32-bit (61 MB) (Info)   (我安装的是32位,根据你的情况)

2、安装 g++

     输入命令 : sudo apt-get install g++

      如果安装了g++或其他的编译器,这步就省略。

3、接下来就开始安装:

    输入命令 :sudo apt-get install qt4-dev-tools qt4-designer qt4-doc qt4-qtconfig qt4-demos qt4-qmake

      等待安装完。

     说明下这句命令:

      qt4-dev-tools 中包括了Qt Assistant,Qt Linguist    

    qt4-doc 这个是帮助文档     

    qt4-qtconfig Qt的配置工具,这个装好默认好    

    qt4-demos 官方的一些Demo    

    qt4-designer 可视化窗体设置工具

4、安装Qt Creator

      进入下载的QT creator所在目录,比如我的在Downloads就 输入命令 :cd Downloads

      进入目录后,输入命令:sudo chmod +x qt-creator-linux-x86-opensource-2.8.0.run     

      输入密码后, 输入命令   ./qt-creator-linux-x86-opensource-2.8.0.run   (文件名qt-creator-linux-x86-opensource-2.8.0.run可能不同,根据你自己的写)

   之后会出现如下界面:

     1

 

     安装完之后 :

           2

     

     下面就来个最经典的hello word!

#include "mainwindow.h"
#include <QApplication>
#include <QLabel>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QLabel *label = new QLabel("hello word!");
    label->show();
    return a.exec();
}

   我建的是mainwindow工程,只修改main.cpp如上。

  编译运行:

    3

    PS:如果编译出现错误: :-1: error: Qt Creator needs a compiler set up to build. Configure a compiler in the kit options.

    这个错误是说找不到编译器,所以我们要自己选定一个,方法如下:

    Tools -> Options -> Build & Run -> Compilers  看看有没有选择编译器,我的如下:

     4

   然后再看看Kits 选项下的 Compiler 有没有选择编译器。我的如下:

    5

  这样问题就解决了!