标题:请问undefined reference to `QWidget::x11Event(_XEvent*)'是哪个参数没设对吗
作者:xqwxqw
日期:2007-03-21 22:02
内容:
在qte中用tmake生成的makefile文件后,执行make:
# make
g++ -c -pipe -Wall -W -O2 -DNO_DEBUG -fno-rtti -fno-exceptions -I/public/qt/qt-2.3.2/include -o hello.o hello.cpp
/public/qt/qt-2.3.2/include/qtooltip.h:87: 警告:‘class QToolTip’ 有虚函数却没有虚析构函数
g++ -c -pipe -Wall -W -O2 -DNO_DEBUG -fno-rtti -fno-exceptions -I/public/qt/qt-2.3.2/include -o main.o main.cpp
/public/qt/qt-2.3.2/bin/moc hello.h -o moc_hello.cpp
g++ -c -pipe -Wall -W -O2 -DNO_DEBUG -fno-rtti -fno-exceptions -I/public/qt/qt-2.3.2/include -o moc_hello.o moc_hello.cpp
g++ -o hello hello.o main.o moc_hello.o-L/public/qt/qt-2.3.2/lib -L/usr/X11R6/lib -lqte -lXext -lX11 -lm
moc_hello.o(.gnu.linkonce.r._ZTV5Form1+0x14c): undefined reference to `QWidget::x11Event(_XEvent*)'
moc_hello.o(.gnu.linkonce.r._ZTV5Form1+0x1b8): undefined reference to `QPaintDevice::setX11Data(QPaintDeviceX11Data const*)'
collect2: ld 返回 1
make: *** 错误 1
请问高手为何啊?????
#1 [XChinux 03-22 09:00]
一般是没有把库链接进去的缘故。
#2 [honest581 06-08 22:48]
sfsfds
#3 [honest581 06-08 22:49]
到底怎么解决啊,我也遇到类似的问题我都搞了半个月了,也没有头绪
#4 [liubaosen 08-29 14:11]
You're mixing rtti and non-rtti code. When compiling for Qt/Embedded make sure to add
-fno-rtti to the CXXFLAGS and LDFLAGS. Make sure not leave those out when compiling for
Qt/X11 . Ah, and also make sure when compiling for QT/Embedded to add a -DQWS to your
CXXFLAGS (it's missing above there aswell), that solves the x11Event errors. (the rtti
thingy fixes the type_info errors)
#5 [hatoyu 05-08 14:39]
引用第1楼XChinux于2007-03-22 09:00发表的 :
一般是没有把库链接进去的缘故。
具体那么加进去阿?