当前位置: 技术问答>linux和unix
qt编译的一个问题
来源: 互联网 发布时间:2015-10-23
本文导语: 在编译程序中,出现这样的问题 moc_pform.o(.gnu.linkonce.d._ZTV6CPForm+0x1a4): more undefined references to `QWidget::icHolderWidget()' follow moc_platform.o(.gnu.linkonce.d._ZTV9CPlatform+0x78): undefined reference to `QApplication::locateICHolderWidget(QWidget*...
在编译程序中,出现这样的问题
moc_pform.o(.gnu.linkonce.d._ZTV6CPForm+0x1a4): more undefined references to `QWidget::icHolderWidget()' follow
moc_platform.o(.gnu.linkonce.d._ZTV9CPlatform+0x78): undefined reference to `QApplication::locateICHolderWidget(QWidget*)'
moc_platform.o(.gnu.linkonce.d._ZTV9CPlatform+0x7c): undefined reference to `QApplication::icHolderWidgets()'
moc_plistbox.o(.gnu.linkonce.d._ZTV9CPListBox+0x1a4): undefined reference to `QWidget::icHolderWidget()'
moc_plistview.o(.gnu.linkonce.d._ZTV10CPListView+0x1a4): undefined reference to `QWidget::icHolderWidget()'
moc_pobject.o(.gnu.linkonce.d._ZTV8CPObject+0x1a4): undefined reference to `QWidget::icHolderWidget()'
moc_potlist.o(.gnu.linkonce.d._ZTV8CPOTList+0x1a4): undefined reference to `QWidget::icHolderWidget()'
moc_potobject.o(.gnu.linkonce.d._ZTV10CPOTObject+0x1a4): undefined reference to `QWidget::icHolderWidget()'
moc_pscrollbar.o(.gnu.linkonce.d._ZTV11CPScrollBar+0x1a4): more undefined references to `QWidget::icHolderWidget()' follow
collect2: ld returned 1 exit status
make: *** [../bin/linuxeng] Error 1
请问发生这种情况是什么原因? 怎么才能解决了?
moc_pform.o(.gnu.linkonce.d._ZTV6CPForm+0x1a4): more undefined references to `QWidget::icHolderWidget()' follow
moc_platform.o(.gnu.linkonce.d._ZTV9CPlatform+0x78): undefined reference to `QApplication::locateICHolderWidget(QWidget*)'
moc_platform.o(.gnu.linkonce.d._ZTV9CPlatform+0x7c): undefined reference to `QApplication::icHolderWidgets()'
moc_plistbox.o(.gnu.linkonce.d._ZTV9CPListBox+0x1a4): undefined reference to `QWidget::icHolderWidget()'
moc_plistview.o(.gnu.linkonce.d._ZTV10CPListView+0x1a4): undefined reference to `QWidget::icHolderWidget()'
moc_pobject.o(.gnu.linkonce.d._ZTV8CPObject+0x1a4): undefined reference to `QWidget::icHolderWidget()'
moc_potlist.o(.gnu.linkonce.d._ZTV8CPOTList+0x1a4): undefined reference to `QWidget::icHolderWidget()'
moc_potobject.o(.gnu.linkonce.d._ZTV10CPOTObject+0x1a4): undefined reference to `QWidget::icHolderWidget()'
moc_pscrollbar.o(.gnu.linkonce.d._ZTV11CPScrollBar+0x1a4): more undefined references to `QWidget::icHolderWidget()' follow
collect2: ld returned 1 exit status
make: *** [../bin/linuxeng] Error 1
请问发生这种情况是什么原因? 怎么才能解决了?
|
看看这个链接是否对你有帮助:
http://www.qtforum.org/thread.php?postid=15263
里面有一段:
Try this:
move the declaration of your widget class to its own .h file.
Add this to the HEADERS line of the .pro file.
......
Remember that you have to invoke "qmake" to generate new Makefile each time you change .pro file or
add a Q_OBJECT macro in one of your classes.
http://www.qtforum.org/thread.php?postid=15263
里面有一段:
Try this:
move the declaration of your widget class to its own .h file.
Add this to the HEADERS line of the .pro file.
......
Remember that you have to invoke "qmake" to generate new Makefile each time you change .pro file or
add a Q_OBJECT macro in one of your classes.
|
正在学习Qt,好像用Qt的人不多呀,帮你顶一下