Qte 2编程,生成工程可以使用progen,也可使用qmake。
 

设置环境变量

脚本放在/home/chenxibing/lpc3250/qtopia-x86/qtopia-free-2.2.0-x86目录下,内容如下:
  1   2 echo Start Setting env-var   3 export QTDIR=$PWD/qt2   4 export QTEDIR=$QTDIR   5 export QPEDIR=$PWD/qtopia   6 export TMAKEDIR=$PWD/tmake   7 export QMAKESPEC=linux-g++   8 export TMAKEPATH=$TMAKEDIR/lib/qws/linux-generic-g++   9 export PATH=$QTDIR/bin:$QPEDIR/bin:$TMAKEDIR/bin:$PATH 10 export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
 

生成工程文件

方法一:使用qmake生成工程:

[chenxibing@localhost helloqt]$ qmake -project [chenxibing@localhost helloqt]$ ls helloqt.cpp  helloqt.pro
 
工程文件内容: [chenxibing@localhost helloqt]$ vi helloqt.pro
  1 ######################################################################   2 # Automatically generated by qmake (1.06c-Qtopia) Thu Jun 25 15:25:37 2009   3 ######################################################################   4   5 TEMPLATE = app   6 CONFIG -= moc   7 INCLUDEPATH += .   8   9 # Input 10 SOURCES += helloqt.cpp

方法二:使用progen生成工程

[chenxibing@localhost helloqt]$ progen -t app.t -o helloqt.pro [chenxibing@localhost helloqt]$ ls helloqt.cpp  helloqt.pro
工程文件内容:
  1 TEMPLATE    = app   2 CONFIG      = qt warn_on release   3 HEADERS     =   4 SOURCES     = helloqt.cpp   5 INTERFACES  =
 
 

生成Makefile文件

方法一:使用qmake生成Makefile

[chenxibing@localhost helloqt]$ qmake  helloqt.pro        (-o Makefile ) #-o Makefile可以不写 [chenxibing@localhost helloqt]$ ls helloqt.cpp  helloqt.o  helloqt.pro  Makefile
 

方法二:使用tmake生成Makefile

[chenxibing@localhost helloqt]$ tmake -o Makefile helloqt.pro [chenxibing@localhost helloqt]$ ls helloqt.cpp  helloqt.pro  Makefile
 

编译:

[chenxibing@localhost helloqt]$ make g++ -c -pipe -Wall -W -O2  -DQT_NO_DEBUG -I/home/chenxibing/lpc3250/qtopia-x86/qtopia-free-2.2.0-x86/qtopia/mkspecs/linux-g++ -I. -I. -I/home/chenxibing/lpc3250/qtopia-x86/qtopia-free-2.2.0-x86/qt2/include -o helloqt.o helloqt.cpp g++ -Wl,-rpath,/home/chenxibing/lpc3250/qtopia-x86/qtopia-free-2.2.0-x86/qt2/lib -o helloqt helloqt.o   -L/home/chenxibing/lpc3250/qtopia-x86/qtopia-free-2.2.0-x86/qt2/lib -L/usr/X11R6/lib -lqt -lXext -lX11 -lm [chenxibing@localhost helloqt]$ ls helloqt  helloqt.cpp  helloqt.o  helloqt.pro  Makefile
posted on 2012-04-28 15:23  风行雪舞  阅读(391)  评论(0编辑  收藏  举报
无觅相关文章插件,快速提升流量