#tar zxvf qt-x11-opensource-src-4.3.2.tar.gz -C /usr/local //½«qt-x11-opensource-src-4.2.3.tar.gzÔ´Âë°ü½âѹËõµ½/usr/localĿ¼£¨ÍƼö½âѹËõÖÁ /usr/localĿ¼£©
¶þ¡¢½øÈëÓû§¼ÒĿ¼µÄ.bash_profileÎļþÉèÖÃQt»·¾³±äÁ¿£¬ÔÚÕâÀïÎÒÃÇÒÔrootÓû§ÒÔÀý¡£
#vi /root/.bash_profile //´ò¿ªrootÓû§.bash_profileÎļþ
ÔÚrootÓû§.bash_profileÎļþÖÐÉèÖû·¾³±äÁ¿£¬ÔÚ´ËÎļþÀïÃæÌí¼ÓÈçÏÂÄÚÈÝ£º
QTDIR=/usr/local/qt-x11-opensource-src-4.3.2.tar.gz
PATH=$QTDIR/bin:$PATH
MANPATH=$QTDIR/doc/man:$MANPATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QTDIR PATH MANPATHLD_LIBRARY_PATH
Ìí¼ÓÍêÉÏÃæÐÅÏ¢ºó°´ESC¼ü£¬¡°Shife+:¡±×éºÏ¼ü»Øµ½vi±à¼Æ÷ÃüÁîÐÐ״̬£¬ÊäÈëwq!£¨Ç¿ÖƱ£´æÍ˳ö£©
Èý¡¢Ìí¼ÓÍê»·¾³±äÁ¿ºó£¬Ê¹»·¾³±äÁ¿Á¢¼´ÉúЧ£º#source /root/.bash_profile
ËÄ¡¢½øÈëQt½âѹËõµÄĿ¼
#cd $QTDIR»ò#cd /usr/local/qt-x11-opensource-src-4.3.2.tar.gz¶¼¿ÉÒÔ£¬ÒòΪÔÚ/root/.bash_profileÎļþÒѾ¶¨ÒåÁË»·¾³±äÁ¿QTDIR= /usr/local/qt-x11-opensource-src-4.3.2.tar.gzºÍexport QTDIR ¡£
Î塢ʹÓÃconfigure¹¤¾ßÀ´¹¹½¨Qt¿âºÍËüÌṩµÄ¹¤¾ß£º./configure£¨./configure --help ÅäÖÃÑ¡ÔñµÄÁÐ±í¡£Àý£º-threadÑ¡ÏîÀ´´´½¨Õâ¸ö¿âµÄÒ»¸ö¶à´¿ÖÖ°æ±¾¡££©
Áù¡¢×îºóÒ»²½¾ÍÒª½øÈëÂþ³¤µÄQt°²×°±àÒëʱ¼äÁË£¬ÓÐʵľͳöÈ¥°ìÊ°ɣ¬°²×°±àÒëʱ¼ä´óÔ¼ÐèÒªÁ½¸öСʱ¡£±àÒëÃüÁmake
Qt°²×°¹ý³Ì¾ÍÊÇÕâÑùÁË£¬×£Äú°²×°Qt³É¹¦£¡
Ê×ÏÈÎÒÃǽøÈëLinuxµÄͼÐνçÃ棬´ò¿ªÒ»¸ö¿ØÖÆÖնˣ¨ÔÚ×ÀÃæ¿Õ¼ä´¦µ¥»÷Êó±êÓÒ¼ü£¬ÔÚµ¯³öµÄµ¥²ËÖÐÑ¡Ôñ¡°Ð½¨¿ØÖÆÖնˡ±¡££©£¬ÔÚ¿ØÖÆÖÕ¶ËÀïÃæн¨Ò»¸ö.cppÎļþ£¬²¢±àд³ÌÐò£¬ÈçÏ£º
#vi HelloWorld.cpp //½¨Á¢Ò»¸öHelloWorld.cppÎļþ
#include
#include
int main(int argc,char *argv[])
{
QApplication app(argc,argv);
QLabel *label=new QLabel("Hello World!!!",0);
app.setMainWidget(label);
label->show();
return app.exec();
}
дÍêÉÏÃæµÄ´úÂëºó±£´æÍ˳ö£¨wq£©vi±à¼Æ÷¡£
#qmake -project //°Ñ.cppÎļþ±àÒë³É.proÎļþ
#qmake HelloWorld.pro //ͨ¹ý.proÎļþ×Ô¶¯´´½¨MakefileÎļþ
#make //±àÒ룬Éú³ÉHelloWorldÖ´ÐÐÎļþ
#./HelloWorld //ÔËÐÐHelloWorldÎļþ
³ÌÐòÕý³£ÔËÐжԻ°¿òÏÔʾ¡°HelloWorld!!!¡±£¬Ö¤Ã÷Qt°²×°³É¹¦£¡
Èç¹û±àÒëʱºò³öÏÖ´íÎó£ºQMAKESPEC has not been set, so configuration cannot be deduced.
Error processing project file: XXXXX.pro
ÊÇQMAKESPEC±äÁ¿Ã»ÓÐÉèÖúã¬ÔÚ/root/.bash_profileÀï¼ÓÈëÒ»ÐУº
export QMAKESPEC=/usr/local/qt-x11-opensource-src-4.3.2/mkspecs/linux-g++£¨¼´ÊÇlinux-g++µÄ·¾¶£©¡£