回复: 【提问】谁诉我用kdevelop做个QT程序hello world就满足了.
#6 [acefunware 09-01 16:24]
你用vi或着emacs或者其他的编辑器来输入代码。
不要用kdevelop
把代码放在一个文件夹中
用
#7 [magicoy 09-01 22:45]
这样是好.可是编译总出错.
QT库出问题了........要重新编译.哎.
#8 [acefunware 09-07 10:11]
不知道你用的是什么版本的linux我用的是debian
建议你重新装一下Qt
#9 [acefunware 09-07 10:13]
在windows 下面try一下
呵呵
#10 [junjie 10-13 21:22]
用gccmake
代码:/* helloworld.cpp */
#include
#include
#include
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());
}
makefile:
INCL= -I$(QTDIR)/include -I$(KDEDIR)/include
CFLAGS= -O2 -fno-strength-reduce
LFLAGS= -L$(QTDIR)/lib -L$(KDEDIR)/lib -L/usr/X11R6/lib
LIBS= -lqt -lX11 -lXext
CC=g++
helloworld: helloworld.o
$(CC) $(LFLAGS) -o helloworld helloworld.o $(LIBS)
helloworld.o: helloworld.cpp
clean:
rm -f helloworld
rm -f helloworld.o
.SUFFIXES: .cpp
.cpp.o:
$(CC) -c $(CFLAGS) $(INCL) -o $@ $<
在ksonle用 make就好了