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
俺不想用那工具啊,只想了解低层的东西!