debian下QT4编程环境的建立

转:http://moosewoler.blog.163.com/blog/static/6986605200801013442336/

QT是一款跨平台的C++编程framework。QT的主要特性就是它丰富的界面组件集。

使用debian的deb包安装软件是,安装软件是非常容易的一件事。

使用apt-get安装:

apt-get update

apt-get install build-essentail

apt-get install libqt4-core libqt4-debug libqt4-dev libqt4-gui libqt4-qt3support libqt4-sql python-qt4 python-qt4-common qt4-designer qt4-dev-tools qt4-doc qt4-qtconfig

(如果又找不到的软件包,跳过即可,我在安装的时候libqt4-debug和python-qt4-common找不到,我安装的软件包有:

apt-get install libqt4-core libqt4-dev libqt4-gui libqt4-qt3support libqt4-sql python-qt4 qt4-designer qt4-dev-tools qt4-doc qt4-qtconfig

使用aptitude的话,只需要安装qt4-designer,其他的包就依据依赖性自动安装了(qt4-dev-tools python-qt4除外)。

写个hello qt程序检验:

//helloworld.cpp

#include <QApplication>

#include <QLabel>

int main(int argc,char *argv[])

{

QApplication app(argc,argv);

QLabel *label=new QLabel("Hello Qt!");

label->show();

return app.exec();

}

编译过程:

qmake-qt4 -project -o hello.pro

qmake-qt4 hello.pro

make

注:因为本机上已经安装了qt3,所以需要指定qmake版本

运行程序:

./hello