Linuxƽ̨ÏÂQtÓ¦ÓóÌÐò¿ª·¢Ö®Hello world£¬Æäʵ¾ÍÊÇѧ×ÅÈçºÎ½¨Á¢¿ª·¢»·¾³¼°ÈçºÎ½«Ô´Îļþ±äΪ¿ÉÕýÈ·Ö´ÐеijÌÐò¡£ÕâÀïÊÇʹÓÃC++½øÐпª·¢µÄÁ÷³Ì¡£
1.°²×°Qt¿ª·¢¿â
ÓжàÖÖ·½·¨¿ÉÒÔ°²×°£¬¿É¸ù¾Ýʵ¼ÊÇé¿ö½øÐÐÑ¡Ôñ¡£ÔÚFedora core 7 (FC7)ÉÏ¿ÉʹÓÃÈí¼þ°ü¹ÜÀíÆ÷À´×Ô¶¯°²×°¡£ÔËÐÐÈí¼þ°ü¹ÜÀíÆ÷£¬Ñ¡Ôñ£º ¿ª·¢ -> KDEÈí¼þ¿ª·¢£¬ÈçÏÂͼ£º
[attach]8641[/attach]
µã»÷¡°¿ÉÑ¡µÄÈí¼þ°ü¡±°´Å¥´ò¿ªÑ¡Ôñ¶Ô»°¿ò£¬ÈçÏÂͼ£º
[attach]8642[/attach]
¹´Ñ¡¡°qt4-devel-***¡±£¬Development files for the Qt toolkit¡£ ***¿ÉÄÜ»áÒòƽ̨¼°°æ±¾¶øÓÐËù²îÒì¡£µã»÷close°´Å¥¹Ø±Õ¶Ô»°¿ò£¬È»ºó½øÐа²×°¡£
2.±à¼Ô´Îļþ
н¨Ä¿Â¼qthello,²¢½øÈëqthelloĿ¼
mkdir qthello
cd qthello
×¢Ò⣺Qt ³ÌÐòÏîÄ¿²»ÄÜÒÔ "qt"¡¢¡°qt-mt¡±¡¢¡°qte¡± µÈ×÷ΪÆ䶥¼¶Ä¿Â¼Ãû£¬·ñÔò±àÒëʱ»á·¢Éú´íÎó¡£
½¨Á¢Ô´Îļþhello.cpp,²¢ÊäÈëÏÂÁÐÄÚÈÝ£¬È»ºó±£´æ¡£
ÒýÓÃ:#include
#include
int main( int argc, char **argv )
{
QApplication a( argc, argv );
QPushButton hello( "Hello world!", 0 );
hello.resize( 100, 30 );
a.setMainWidget( &hello );
hello.show();
return a.exec();
}
3.±àÒë
ÒÀ´Î¼üÈëÏÂÁÐÃüÁ
qmake -project #×Ô¶¯Éú³É¹¤³ÌÎļþ qthello.pro
qmake #×Ô¶¯Éú³ÉMakefileÎļþ
make #±àÒ룬Éú³ÉÄ¿±êÎļþhello.oºÍ×îÖյĿÉÖ´ÐгÌÐòqthello
4.ÔËÐÐ
ÔÚµ±Ç°Ä¿Â¼¼üÈëÏÂÁÐÃüÁ
./qthello
ÔËÐнá¹ûÈçÏ£º
[attach]8643[/attach]
×ÜÌåÀ´ËµÊ®·Ö¼òµ¥£¬¹¤³ÌÎļþÒÔ¼°MakefileÎļþµÄ×Ô¶¯Éú³É´ó´ó¼ò»¯ÁË¿ª·¢¹ý³Ì¡£
wujiaodalou911 ÓÚ 2014-01-25 09:37:29·¢±í:
ÁªÏµÒ»Ï¡£¡£¡£¡£
godman ÓÚ 2014-01-19 18:45:53·¢±í:
²»´í ºÜÓаïÖú°¡
herb734044860 ÓÚ 2013-12-28 20:31:55·¢±í:
:0)1
1033150 ÓÚ 2013-10-05 11:19:31·¢±í:
¸Ï½ô½»²æ±àÒë°É
andrea ÓÚ 2012-12-14 23:24:48·¢±í:
ºÜÇ¿´ó
sourcehappy ÓÚ 2011-11-22 17:21:29·¢±í:
ÒÔºó»áѧµÃ
hailiang0208 ÓÚ 2011-11-22 14:24:22·¢±í:
Õâ¸öÌû×Ó²»´í~
wozdaixxma ÓÚ 2010-09-01 21:15:39·¢±í:
ÃüÁîûÓÐÕÒµ½ Similar command is: 'make'
wozdaixxma ÓÚ 2010-09-01 21:12:41·¢±í:
лл·ÖÏí£¡
fsy7901 ÓÚ 2010-02-09 17:41:05·¢±í:
»¹Ã»Ñ§µ½ÄÇÒ»²½
bolderson ÓÚ 2010-01-26 11:31:14·¢±í:
ºÇºÇ~ѧϰÖÐ
Alog_W ÓÚ 2009-12-16 17:20:57·¢±í:
ÏÖÔÚÊÇqt4ÁË,Â¥Ö÷µÄ´úÂëÊÇqt5µÄ
ÒªÔÚ¿ªÊ¼¼ÓÉÏÕâ¾ä[code]
#define QT3_SUPPORT
[/code]
ñÒÏÈÉú ÓÚ 2009-11-06 15:44:30·¢±í:
Ì«ºÃÁË
beyondhong ÓÚ 2009-10-04 23:17:23·¢±í:
ÓÐûÓÐ redhat ÃüÁîÐа²×°~~
shenhao0129 ÓÚ 2009-09-11 23:30:26·¢±í:
Õâ¸öÏÈmarkһϣ¬ÂíÉϾͻáÓõ½ÁË
xiazhouquan ÓÚ 2009-09-11 20:00:30·¢±í:
лл£¬Ñ§Ï°ÁË
xiazhouquan ÓÚ 2009-09-03 10:21:06·¢±í:
ҪѧQTµÄ£¬ÊÕÏÂÁË£¬Ð»Ð»Â¥Ö÷
ljbhander ÓÚ 2009-08-18 14:18:01·¢±í:
qt²»´í£¬Èç¹ûÃâ·Ñ¾Í¸üºÃÁË
AOACGO ÓÚ 2009-08-13 18:52:47·¢±í:
OH
rockeinstein ÓÚ 2009-08-13 18:23:36·¢±í:
¾ÍÊÇÕâ¸öÑù×Ó
rockeinstein ÓÚ 2009-08-13 18:17:58·¢±í:
hello.cpp: In function int main(int, char**):
hello.cpp:8: error: class QApplication has no member named setMainWidget
ÇëÎʸ÷λ´óϺ£¬Õâ¸ö´íÊÇÔõô»ØÊ£¿
»¹ÓÐÎÒµÄqt designer´ò¿ªÒÔºónew£>file£¬Ö»Äܽ¨Á¢ÐµĴ°¿Ú£¬²¢Ã»ÓпÉÒÔÑ¡Ôñ½¨Á¢ÐµÄc£«£« procejtµÄÑ¡ÏÇëÎÊÔõô°ì£¿
ÎÒÊÇÐÂÊÖ£¬¶àÖ¸½Ì£¡
rockeinstein ÓÚ 2009-08-13 18:14:36·¢±í:
[i=s] ±¾Ìû×îºóÓÉ rockeinstein ÓÚ 2009-8-13 18:17 ±à¼ [/i]
hello.cpp: In function int main(int, char**):
hello.cpp:8: error: class QApplication has no member named setMainWidget
ÇëÎʸ÷λ´óϺ£¬Õâ¸ö´íÊÇÔõô»ØÊ£¿
»¹ÓÐÎÒµÄqt designer´ò¿ªÒÔºónew£>file£¬Ö»Äܽ¨Á¢ÐµĴ°¿Ú£¬²¢Ã»ÓпÉÒÔÑ¡Ôñ½¨Á¢ÐµÄc£«£« procejtµÄÑ¡ÏÇëÎÊÔõô°ì£¿
ÎÒÊÇÐÂÊÖ£¬¶àÖ¸½Ì£¡
you_me ÓÚ 2009-05-19 11:56:01·¢±í:
Ö§³Öһϣ¡£¡
52jimmy ÓÚ 2009-05-18 15:28:34·¢±í:
ѧϰһÏÂ
haibian ÓÚ 2009-05-02 06:37:22·¢±í:
ÊÔÒ»ÏÂ
---
À¶ÑÕÖª¼º ÓÚ 2009-04-28 20:52:03·¢±í:
²»Ì«¶®¹þ£¬²»¹ýÎÒÃÇÏÂÖܾÍҪѧϰQTÁ˹þ
asdfgtanxin ÓÚ 2009-04-10 18:01:29·¢±í:
ºÃÏñÔÚÄÄ¿´¹ý°¡ ÐÖµÜ ÒÔºó¶à·¢·¢ ´ó¼ÒÒ»ÆðÌÖÂÛ ¶àл´ó¸çµÄ·ÖÏí!
LiuCan007 ÓÚ 2009-04-05 13:34:38·¢±í:
»¹ÊÇÏÈѧlinuxϵÄC
jerry520 ÓÚ 2009-03-23 13:32:40·¢±í:
²»´íÓÖѧϰÁË.
lgwfw ÓÚ 2008-10-22 13:29:19·¢±í:
Ö§³Ö,QTÊǸöͦ²»´íµÄ¶«Î÷,
shourenyu ÓÚ 2008-10-21 11:16:34·¢±í:
Ö§³Ö£¡~
lmw303 ÓÚ 2008-08-23 14:35:59·¢±í:
дµÄ×îÎÒºÜÓаïÖú£¡Ð»Ð»£¡