解决QT:forward declaration of 'struct Ui::xxx';invalid use of incomplete struct "Ui::Widget" 等莫名奇异错误
今天在进行QT Widget的UI设计时,改了下Widget的对象名,然后在多次成功编译执行后,执行清理,又一次构建,就出现了好多莫名奇异的错误:
widget.h:12: 错误:forward declaration of 'struct Ui::Widget'
widget.cpp:8: 错误:invalid use of incomplete type 'struct Ui::Widget'
网上搜索发现是每当你新键一个 QT设计界面, QT会自己主动生成yyy.ui文件,如Widget.ui,因为我直接新建的GUI程序,同一时候也生成了相应的类。Widget,这时我改变了UI的对象名。类里却仍然使用了Widget这个类名。因此会导致出错。
解决方法是,先把有moc生成的ui_widget.h(与xxx.ui相应的)删掉。然后将界面的对象名设置为,
namespace
Ui
{
class
Widget;
}
中相应的类名。
也就时:在ui中将这个ui里widget或者dialog或者mainwindow的名字改动为错误里提及的“struct
Ui::Widget”中的Widget。总之。要保持ui文件里class项的值与ui中widget或dialog或mainwindow的ObjectName同样!
解决QT:forward declaration of 'struct Ui::xxx';invalid use of incomplete struct "Ui::Widget" 等莫名奇异错误的更多相关文章
- Qt中forward declaration of struct Ui::xxx的解决
每当你新键一个 QT设计界面, QT会自动生成yyy.ui文件,如 <?xml version="1.0" encoding="UTF-8"?> & ...
- Receiver type ‘X’ for instance message is a forward declaration
这往往是引用的问题. ARC要求完整的前向引用,也就是说在MRC时代可能仅仅须要在.h中申明@class就能够,可是在ARC中假设调用某个子类中未覆盖的父类中的方法的话.必须对父类.h引用,否则无法编 ...
- forward declaration of class 错误
在使用Qt的时候遇到这个错误,查了一下发现,是因为我没有正确的使用前置声明. #ifndef FIRSTPAGE_H #define FIRSTPAGE_H #include "ui_dia ...
- The dis/advantage of forward declaration
In our projects, in C++ head file, if reference to some classes (reference or pointer), instead of i ...
- 宋宝华: Linux内核编程广泛使用的前向声明(Forward Declaration)
本文系转载,著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 作者:宋宝华 来源: 微信公众号linux阅码场(id: linuxdev) 前向声明 编程定律 先强调一点:在一切可 ...
- Forward reference vs. forward declaration
Q:Im a bit confused. What is the difference between forward declaration and forward reference? Forwa ...
- 解决Qt程序在Linux下无法输入中文的办法
解决Qt程序在Linux下无法输入中文的办法 一位网友问我怎样在Linux的Qt的应用程序中输入中文,我一開始认为不是什么问题,可是后面自己尝试了一下还真不行.不仅是Qt制作的应用程序,就连Qt Cr ...
- 【Qt开发】解决Qt程序在Linux下无法输入中文的办法
解决Qt程序在Linux下无法输入中文的办法 一位网友问我如何在Linux的Qt的应用程序中输入中文,我一开始觉得不是什么问题,但是后面自己尝试了一下还真不行.不仅是Qt制作的应用程序,就连Qt Cr ...
- #include和前置声明(forward declaration)
#include和前置声明(forward declaration) 1. 当不需要调用类的实现时,包括constructor,copy constructor,assignment opera ...
随机推荐
- [Android Traffic] 调整定时更新的频率(C2DM与退避算法)
转载自: http://blog.csdn.net/kesenhoo/article/details/7395253 Minimizing the Effect of Regular Updates[ ...
- codeigniter与swfupload完整解决方案
转自:http://blog.sina.com.cn/s/blog_6d8dc8eb0100s4bv.html codeigniter(简称ci)有研究了一段时间了,看重的是ci的轻量,便捷,最近公司 ...
- nginx $document_uri 参数使用
$document_uri 表示访问的url 现在我的需求是,访问 www.abc.com 请求到 www.abc.com/abc/在nginx配置文件中加入 if ($document_uri ...
- 关于#include文件包含
1.对于函数头文件: #include <filename> 一般对于标准库文件以一个.h后缀结尾: 2.对于本地文件: #include "filename.h" 对 ...
- idea 去掉never used 提示
- tar命令解压缩出错
[root@zhoucentos share1]# tar zxvf otp_src_19..tar.gz gzip: stdin: not in gzip format tar: Child ret ...
- 将 xml 文件 转为 DataTable
private static DataTable CreateDataTable(string table) { DataSet dataSet = new DataSet(); string dat ...
- [Algorithm] Maximum Contiguous Subarray algorithm implementation using TypeScript / JavaScript
Naive solution for this problem would be caluclate all the possible combinations: const numbers = [1 ...
- Angular 学习笔记——factory
<!DOCTYPE HTML> <html ng-app="myApp"> <head> <meta http-equiv="C ...
- Linux下的各文件夹的作用(转)
linux下的文件结构,看看每个文件夹都是干吗用的/bin 二进制可执行命令 /dev 设备特殊文件 /etc 系统管理和配置文件 /etc/rc.d 启动的配置文件和脚本 /home 用户主目录的基 ...