首页| 论坛| 消息

标题:【提问】新手请教各位一个问题……各位老大请进
作者:guazi111
日期:2006-02-26 02:19
内容:

才准备学QT,但是第一个程序就卡住了……(《24小时学通QT》中的第一个例子)

#include
#include
#include
int main(int argc,char **argv)
{
QApplication a(argc,argv);
QWidget mainwindow;
mainwindow.setMinimumSize(200,100);
mainwindow.setMaxmumSize(200,100);
QPushButton helloworld("Hello World!",&mainwindow);
helloworld.setGeometry(20,20,160,60);
a.setMainWidget(&mainwindow);
mianwindow.show();
return a.exec();
}
之后qmake -project
qmake都没事
make之后提示:
# make
g++ -c -pipe -Wall -W -O2 -g -pipe -D_FORTIFY_SOURCE=2 -m32 -march=i686 -mcpu=i686 -mtune=i686-DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -I/usr/lib/qt-3.3/mkspecs/default -I. -I. -Isrc -I/usr/lib/qt-3.3/include -o h.o src/h.cpp
src/h.cpp: In function `int main(int, char**)':
src/h.cpp:31: error: 'class QWidget' has no member named 'setMaxmumSize'
src/h.cpp:37: error: `mianwindow' undeclared (first use this function)
src/h.cpp:37: error: (Each undeclared identifier is reported only once for each function it appears in.)
make: *** 错误 1
#
我使用的是magiclinux(一个很优秀的国人制作的社区发行版)自带的qt3.3,《24小时学通qt》中是以qt2作为讲解的,是不是因为版本变化的原因导致一些类发生了变化所以不行??那么各位老大们能推荐几本适合初学者的qt3的中文书籍么??在下英文不好……
多谢各位


#1 [XChinux 02-26 02:38]
# make
g++ -c -pipe -Wall -W -O2 -g -pipe -D_FORTIFY_SOURCE=2 -m32 -march=i686 -mcpu=i686 -mtune=i686 -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -I/usr/lib/qt-3.3/mkspecs/default -I. -I. -Isrc -I/usr/lib/qt-3.3/include -o h.o src/h.cpp
src/h.cpp: In function `int main(int, char**)':
src/h.cpp:31: error: 'class QWidget' has no member named 'setMaxmumSize'
src/h.cpp:37: error: `mianwindow' undeclared (first use this function)
src/h.cpp:37: error: (Each undeclared identifier is reported only once for each function it appears in.)
make: *** 错误 1
#
这不是人家编译器都告诉过你了么?QWidget类里没有setMaxmumSize(应该是setMaximumSizze,你拼写错了), mianwindow没有被声明过(是mainwindow,你又拼写错了)
。。。。。。。。。。。。。。。
你说该怎么说你?
#2 [guazi111 02-26 03:31]
啊,抱歉……
在linux下看超星的电子书看的头都晕了……
多谢多谢
不过有什么qt3的书么》???
现在变成这样子了……

# make
g++-o on main.o on.o moc_on.o -L/usr/lib/qt-3.3/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm
on.o: In function `main':
/usr/lib/qt-3.3/include/qglist.h:151: multiple definition of `main'
main.o:/usr/lib/qt-3.3/include/qglist.h:151: first defined here
/usr/bin/ld: Warning: size of symbol `main' changed from 499 in main.o to 425 in on.o
main.o: In function `main':
main.cpp:(.text+0x6a): undefined reference to `KAboutData::KAboutData(char const*, char const*, char const*, char const*, int, char const*, char const*, char const*, char const*)'
main.cpp:(.text+0x90): undefined reference to `KAboutData::addAuthor(char const*, char const*, char const*, char const*)'
main.cpp:(.text+0xac): undefined reference to `KCmdLineArgs::init(int, char**, KAboutData const*, bool)'
main.cpp:(.text+0xca): undefined reference to `KCmdLineArgs::addCmdLineOptions(KCmdLineOptions const*, char const*, char const*, char const*)'
main.cpp:(.text+0xea): undefined reference to `KApplication::KApplication(bool, bool)'
main.cpp:(.text+0x100): undefined reference to `KMainWindow::canBeRestored(int)'
main.cpp:(.text+0x11e): undefined reference to `on::on()'
main.cpp:(.text+0x133): undefined reference to `KMainWindow::restore(int, bool)'
main.cpp:(.text+0x13c): undefined reference to `KMainWindow::canBeRestored(int)'
main.cpp:(.text+0x148): undefined reference to `KAboutData::~KAboutData()'
main.cpp:(.text+0x15c): undefined reference to `KCmdLineArgs::parsedArgs(char const*)'
main.cpp:(.text+0x174): undefined reference to `on::on()'
main.cpp:(.text+0x199): undefined reference to `KCmdLineArgs::clear()'
main.cpp:(.text+0x1b7): undefined reference to `KApplication::~KApplication()'
main.cpp:(.text+0x1bf): undefined reference to `KAboutData::~KAboutData()'
main.cpp:(.text+0x1de):..
#3 [lcc_zjut 03-03 04:58]
老大,你看的这本书是不是基于KDE的啊?
你写的东东用到了KDE的系统函数库,你没有在KDE环境下,当然会报错了!!!!!!!!!

回复 发表
主题 版块