QT编译错误,求解

软件和网站开发以及相关技术探讨
回复
wangjun403
帖子: 433
注册时间: 2009-07-06 14:26

QT编译错误,求解

#1

帖子 wangjun403 » 2009-11-09 11:33

C++ GUI Programming with Qt 4英文原版书上第二章的例子:Chapter 2. Creating Dialogs Rapid Dialog Design
完全按书上写的代码

wangjun@wj-dt:~/qt/qt-book-test/chap02/gotocell2$ ls
gotocell2.pro gotocelldialog.h main.cpp
gotocelldialog.cpp gotocelldialog.ui


qmake -project
qmake-qt4 gotocell2.pro
然后make

代码: 全选

wangjun@wj-dt:~/qt/qt-book-test/chap02/gotocell2$ make
/usr/bin/uic-qt4 gotocelldialog.ui -o ui_gotocelldialog.h
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I. -o main.o main.cpp
g++ -Wl,-O1 -o gotocell2 main.o    -L/usr/lib -lQtGui -lQtCore -lpthread
main.o: In function `main':
main.cpp:(.text+0x51): undefined reference to `GoToCellDialog::GoToCellDialog(QWidget*)'
collect2: ld returned 1 exit status
make: *** [gotocell2] 错误 1
开始以为自己那里抄写错误,就在网上下了源代码后直接编译,也是提示这个错误
我就接着编译其他例子,也会提示这种错误
这种情况就应该是为自己Qt的问题了

求助!!!
附件
gotocell2.tar.gz
qt源码,各位可以帮为看看除了什么问题
(1.19 KiB) 已下载 74 次
生命只不过是上帝借你一用的资本!
liguanyao
帖子: 50
注册时间: 2009-02-09 20:44

Re: QT编译错误,求解

#2

帖子 liguanyao » 2009-11-10 22:53

我的情况跟你差不多啊。。
lee@lee-laptop:~/c$ make
/usr/bin/qmake-qt4 -unix -o Makefile c.pro
gcc -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o micro.o micro.c
micro.c: In function ‘main’:
micro.c:16: error: expected expression before ‘[’ token
micro.c:20: error: subscripted value is neither array nor pointer
micro.c:23: error: expected declaration or statement at end of input
micro.c:23: error: expected declaration or statement at end of input
make: *** [micro.o] 错误 1
好心人帮忙~
sclzmbie
帖子: 2
注册时间: 2009-10-29 9:35

Re: QT编译错误,求解

#3

帖子 sclzmbie » 2009-11-13 10:14

那是因为GoToCellDialog()这个函数你还没实现呢。
看下一章,就有了。
头像
md5xwl
帖子: 133
注册时间: 2008-10-29 22:16
联系:

Re: QT编译错误,求解

#4

帖子 md5xwl » 2009-11-17 8:50

我的是提示ld error:not find -lqt;

代码: 全选

苏老泉,二十七,始发愤,读书籍。彼既老,犹悔迟。尔小生,宜早思!!
tusooa
帖子: 6548
注册时间: 2008-10-31 22:12
系统: 践兔
联系:

Re: QT编译错误,求解

#5

帖子 tusooa » 2010-01-28 8:17

我的可以啊,你执行

代码: 全选

qmake-qt4 -project &&
qmake-qt4 &&
make
看看

代码: 全选

] ls -ld //
black_cx
帖子: 1
注册时间: 2010-08-19 13:20

Re: QT编译错误,求解

#6

帖子 black_cx » 2010-09-05 23:21

没有错误的!
回复