error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const (转)
2010-04-07 19:19
946 查看
The form that uses slots/signals needs to have the Q_OBJECT, the other form doesnt. Removing the Q_OBJECT on the form that doesnt need the slots/signals results in an dll that does in fact link.
The Q_OBJECT macro at the beginning of the class definition is necessary for all classes that define signals or slots
只有加入了Q_OBJECT,你才能使用QT中的signal和slot机制。
比如编写事件接口等程序时,有时会出现如下问题:
在PC端成功编译,但在开发板端却显示错误:
QObject::connect: No such slot QWidget::*******()
QObject::connect: (sender name: 'unnamed')
QObject::connect: (receiver name: 'unnamed')
这时候,就必须在头文件派生类的时候,首先像下面那样引入Q_OBJECT宏:
class MyMainWindow : public QWidget
{
Q_OBJECT
......
}
(摘自:http://www.qtforum.org/article/17828/linker-problem-error-lnk2001.html和http://blog.chinaunix.net/u2/67519/showart_677875.html)
The Q_OBJECT macro at the beginning of the class definition is necessary for all classes that define signals or slots
只有加入了Q_OBJECT,你才能使用QT中的signal和slot机制。
比如编写事件接口等程序时,有时会出现如下问题:
在PC端成功编译,但在开发板端却显示错误:
QObject::connect: No such slot QWidget::*******()
QObject::connect: (sender name: 'unnamed')
QObject::connect: (receiver name: 'unnamed')
这时候,就必须在头文件派生类的时候,首先像下面那样引入Q_OBJECT宏:
class MyMainWindow : public QWidget
{
Q_OBJECT
......
}
(摘自:http://www.qtforum.org/article/17828/linker-problem-error-lnk2001.html和http://blog.chinaunix.net/u2/67519/showart_677875.html)
相关文章推荐
- error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const
- error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const
- error LNK2001: unresolved external symbol "public: virtual struct QMetaObject
- error LNK2001: unresolved external symbol "public: static struct QMetaObject const QwtPlot::staticMe
- [Qt4]VS2010编译提示error LNK2001: unresolved external symbol "public: virtual struct QMetaObject等错误解决方案
- error LNK2001: unresolved external symbol "public: static struct QMetaObject const QwtPlot::staticMe
- Qt编程之信号与槽-------unresolved external symbol "public: virtual struct QMetaObject const * __thiscall XX::metaObject(void)const
- QT中添加Q_OBJECT时编译提示obj : error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const错误解决方法
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObject
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObject
- 【qt错误】unresolved external symbol "public: virtual struct QMetaObject
- QT遇到unresolved external symbol "public: virtual struct QMetaObject解决方案
- vs2010+qt4编译出现error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject等错误
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall ****::metaObj
- QT + VS2005 编译出现 error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObject 错误
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall MainWindow::metaObje
- song2013 error LNK2001: unresolved external symbol "public: virtual
- 解决unresolved external symbol "protected: virtual struct AFX_EVENTSINKMAP const * __thiscall 错误。
- error LNK2001: 无法解析的外部符号 "public: static struct QMetaObject const
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __cdecl MainWindow::metaObject(