QT手动moc问题:virtual struct QMetaObject const * __thiscall Widget::metaObject
来源:互联网 发布:屏幕视频截取软件 编辑:程序博客网 时间:2024/06/05 14:54
【转自】http://blog.csdn.net/zhenyusoso/article/details/8450906
编写一个简单的给予QT的DEMO程序步骤大致如下:
下面开始编程:
A 编写 main.cpp
B 编写 hello.h
C 编写 hello.cpp
D 制作.ui文件,并生成ui_hello.h
打开designer,拖入一个pushButton,一个label。保存为hello.ui。然后生成ui_hello.h,并添加到项目的源文件中。
编译运行,则出现如下错误:
错误 1 error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObject(void)const " (?metaObject@Widget@@UBEPBUQMetaObject@@XZ)
错误 2 error LNK2001: 无法解析的外部符号 "public: virtual void * __thiscall Widget::qt_metacast(char const *)" (?qt_metacast@Widget@@UAEPAXPBD@Z)
错误 3 error LNK2001: 无法解析的外部符号 "public: virtual int __thiscall Widget::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@Widget@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
错误 4 fatal error LNK1120: 3 个无法解析的外部命令
这是因为在源文件中没有添加上moc_hello.cpp文件。
解决方法:右击hello.h,选择“自定义生成步骤”,“常规”
命令行:moc.exe hello.h -o moc_hello.cpp
输出:moc_hello.cpp
附加依赖项:moc.exe hello.h
确定,然后,右击hello.h,选择 “编译”,则在文件夹中生成moc_hello.cpp,再将其添加到源文件中。
- QT手动moc问题:virtual struct QMetaObject const * __thiscall Widget::metaObject
- QT手动moc问题:virtual struct QMetaObject const * __thiscall Widget::metaObject
- QT手动生成moc问题:virtual struct QMetaObject const * __thiscall Widget::metaObject
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObject
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObject
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObject
- QT error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObjec
- VS2015 + QT 编译出现public: virtual struct QMetaObject const * __thiscall 错误
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __cdecl MainWindow::metaObject(
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall MainWindow::metaObje
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall ****::metaObj
- error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const
- 【qt错误】unresolved external symbol "public: virtual struct QMetaObject
- unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall
- QT中添加Q_OBJECT时编译提示obj : error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const错误解决方法
- error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const (转)
- 解决unresolved external symbol "protected: virtual struct AFX_EVENTSINKMAP const * __thiscall 错误。
- 进程地址空间
- iOS开发中SDK是什么?
- 【学习笔记javascript设计模式与开发实践(策略模式)----5】
- 可重入内核
- 从外网访问VMware虚拟机的Web服务
- QT手动moc问题:virtual struct QMetaObject const * __thiscall Widget::metaObject
- Leetcode #217 Contains Duplicate
- 二进制开关实现
- 九度OJ 1354:和为S的连续正数序列 (整除)
- struts2配置文件详解一
- android中hotpatch
- 内核线程
- 112、path sum
- Java图形用户界面布局控制Layout练习