qt¿â³öÎÊÌâÁ˰¡£¡£¡Ôõô¾ÍûÈ˰ïÎÒ£¿£¿
ºÃ°É£¡£¡ÎÒÌùÎÒµÄÔ´´úÂëºÍ±àÒë¹ý³ÌÖÐËù±¨³öµÄ´íÎó³öÀ´°ÉÔ´´úÂ룺
#include <qapplication.h>
#include <qlabel.h>
#include <qstring.h>
int main(int argc, char **argv)
{
Qapplication app(argc,argv);
Qlabel *label=new Qlabel(NULL);
Qstring string("hello world");
label->setText(string);
label->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter);
label->setGeometry(0,0,180,75);
label->show();
app.setMainWidget(label);
return(app.exec());
}
ÎÒÓÃÀ´±àÒëµÄÃüÁîÊÇ g++ -o download download.cpp -L/usr/lib/qt3/include/
/*ÒòΪÎÒµÄQT¿âĿ¼ÊÇÔÚ/usr/lib/qt3/includeÉÏ£¡£¡*/
Ö®ºó±àÒë³öÀ´Ö®ºó±¨³öµÄ´íÎóÊÇ£º
download.cpp:1:26: qapplication.h: No such file or directory
download.cpp:1:26: qlabel.h: No such file or directory
download.cpp:1:26: qstring.h: No such file or directory
download.cpp: In function 'int main(int,char**)':
download.cpp:7: 'Qapplication' undeclared(first use this function)
download.cpp:7: (Each undeclared identifier is reported only once for each function it appears in.)
download.cpp:7: parse error before '(' token
download.cpp:8: 'Qlabel' undeclared (first use this function)
download.cpp:8: 'label' undeclared (first use this function)
download.cpp:8: parse error before '(' token
download.cpp:9: 'Qstring' undeclared (first use this function)
download.cpp:10: 'string' undeclared (first use this function)
download.cpp:11: 'Qt' undeclared(first use this function)
download.cpp:11:parse error before '::' token
download.cpp:14: 'app' undeclared (first use this function)
´ó¼Ò¿´¿´ÎÒ¸ÃÔõô°ì£¿£¿
Ö®ºóÎÒ°´ÕÕ´ó¼ÒµÄÒâ¼û×öÁËÒ»¸öMakefileÈçÏ£º
INCL=-I$(QTDIR)/include -I$(KDEDIR)/include
CFLAGS=-pipe -O2 -fno-strength-reduce
LFLAGS=-L$(QTDIR)/lib -L$(KDEDIR)/lib -L/usr/X11R6/lib
LIBS=-lqt -lX11 -lXext
CC=g++
download: download.o
$(CC) $(LFLAGS) -o download download.o $(LIBS)
download.o: download.cpp
clean:
rm -f download
rm -f download.o
.SUFFIXES: .cpp
.cpp.o:
$(CC) -c $(CFLAGS) $(INCL) -o $@ $<
µ«ÊÇÎÒ×öÁËÕâ¸öMakefileÖ®ºó£¬Ö®ºóÖ´ÐÐmakeÃüÁ½á¹ûð³öÕâÑùÒ»¾ä´íÎ󣬴ó¼Ò¿´¿´ÊÇʲô£¿
Makefile:8: ***missing separator.stop.
°¥Ñ½£¬makeÒ²²»ÐУ¬G++Ò²²»ÐУ¬ÄѵÀÕæÒªÓÃqtdesigner»òÕßkdeveloper
°³²»ÏëÓÃÄǹ¤¾ß°¡£¬Ö»ÏëÁ˽âµÍ²ãµÄ¶«Î÷£¡ such as:
[COLOR=purple]g++ -o download download.cpp -I/usr/lib/qt3/include -L/usr/lib/qt3/lib -lqt[/COLOR]
no!!no!! the bug still exist!!~
when I compile the program~~the system report that "/usr/bin/ld cannot find -lqt"
what is the matter???
help me!!!! help!!
kk
ºÃ°¡£¬Ð»Ð»£¬ÔÚ´ó¼ÒµÄ°ïÖúÏ£¬ÒѾºÃÁËÒ»´ó°ëÁË£¬µ«ÊÇ»¹ÊÇÓÐÎÊÌ⣡ÎÒÊǰ´ÕÕÏÂÃæµÄ·½·¨±àÒë
g++ -o download download.cpp -L/usr/lib/qt3/lib -I/usr/lib/qt3/include -lqt
¿ªÊ¼Ò»Â·Ë³³©£¬µ«ÊǺóÀ´Ã°³öÒ»¾äÕâÑùµÄ»°£º
/usr/bin/ld cannot find -lqt
µ½µ×ÊÇÔõô»áʰ¡£¿ ok, then you have to add: [COLOR=red]-mt[/COLOR]
thanks!!
thanks~~~and can you tell me where did you search so many information about g++??? ÒòΪа汾µÄqt3,µÄlibqt.soÎļþÒѾ±äΪlibqt-mt.so,¶øÓÃqmake²úÉúµÄmakefileÀïÃæ»¹ÊÇÒýÓÃlibqt.so,ËùÒÔ»áÌáʾ˵ÕÒ²»µ½,¿ÉÒÔÓÃcp libqt-mt.so libqt.soÃüÁî½â¾ö.
Ò³:
[1]