一般出现这种情况都是没有将用到的头文件包含进来

我的情况是在头文件中定义了一个QMenu的指针,在源文件中使用menuBar()函数来返回一个menu指针。我在源文件中包含了文件<QtGui>出现这个错误,

.h

QMenu *fileMenu;

.cpp

fileMenu = menuBar()->addMenu(tr("&File"));

解决办法是:在源文件中添加对<QMenuBar>的包含即可。

error: invalid use of incomplete type的更多相关文章

  1. error “base class has incomplete type”

    error "base class has incomplete type" 如果base.h是你的基类,那么在子类derive中,写成如下形式: class base; clas ...

  2. error: dereferencing pointer to incomplete type

    /******************************************************************************* * error: dereferenc ...

  3. Solve Error: 'has incomplete type', foward declaration of 'class x'

    在C++的OOB编程中,有时候我们会遇到这样的错误Error: 'has incomplete type',forward declaration of 'class x',那么是什么原因引起的这个问 ...

  4. error: field 'b' has imcomplete type

    在下面的程序中,在编译时会遇到下面的错误: error: field 'b' has incomplete type 域b是一个不完备的类型,即class B的声明不完备 #include <i ...

  5. 解决QT:forward declaration of &#39;struct Ui::xxx&#39;;invalid use of incomplete struct &quot;Ui::Widget&quot; 等莫名奇异错误

    今天在进行QT Widget的UI设计时,改了下Widget的对象名,然后在多次成功编译执行后,执行清理,又一次构建,就出现了好多莫名奇异的错误: widget.h:12: 错误:forward de ...

  6. PostgreSQL - invalid input syntax for type timestamp with time zone

    问题 在执行以下sql时报错: select COALESCE(null,null,now(),''); 报错如下: SQL Error [22007]: ERROR: invalid input s ...

  7. error: variable '__this_module' has initializer but incomplete type错误解决

    版权所有,转载必须说明转自 http://my.csdn.net/weiqing1981127 原创作者:南京邮电大学  通信与信息系统专业 研二 魏清 问题描述:使用SAM9X25  内核版本是2. ...

  8. QT编译错误:invalid application of 'sizeof' to incomplete type 'Qt3DRender::QPickEvent'

    执行3D常将中实体的pick操作,结果出现了编译错误:invalid application of 'sizeof' to incomplete type 'Qt3DRender::QPickEven ...

  9. invalid application of `sizeof' to incomplete type `char[] '

    在写代码时,我想用extern来关联一个数组,然后利用sizeof计算数组的大小,代码如下: ... extern char a[]; #define b size=(sizeof(a)/sizeof ...

随机推荐

  1. 学习笔记 ST算法

    [引子]RMQ (Range Minimum/Maximum Query)问题: 对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,j<=n),返回数列A中下标在i,j里的最小(大)值 ...

  2. utf8_general_ci、utf8_unicode_ci和utf8_bin的区别

    utf8_general_ci 不区分大小写,这个你在注册用户名和邮箱的时候就要使用. utf8_general_cs 区分大小写,如果用户名和邮箱用这个就会照成不良后果. utf8_bin: com ...

  3. jquery.validate1.9.0前台验证使用

    一.利用jquery.form插件提交表单方法使用jquery.validate插件 现象:当提交表单时,即使前台未验证通过,也照常提交表单. 解决办法: $('#myForm').submit(fu ...

  4. PHP接收跨域请求header 头设置

    header("Access-Control-Allow-Origin: http://a.com"); // 允许a.com发起的跨域请求 //如果需要设置允许所有域名发起的跨域 ...

  5. [Algorithm -- Dynamic Programming] Recursive Staircase Problem

    For example there is a staricase N = 3 | ---|   |---|    | |---|            | ---|                  ...

  6. T-SQL 之 存储过程

    当存储过程执行一次后,可以将语句缓存中,这样下次执行的时候直接使用缓存中的语句.这样就可以提高存储过程的性能. 一.存储过程的概念 存储过程Procedure是一组为了完成特定功能的SQL语句集合,经 ...

  7. git config 的全局配置

    使用git的全局配置   .gitconfig 一:修改 用户下的.gitconfig 修改如图信息,添加你的信息 二: 命令添加 $ git config --global user.name   ...

  8. git fatal: https://github.com/TeaCodie/TeaCodie-Website.git/info/refs not found: did you run git update-server-info on the server 错误

    错误: fatal: https://github.com/TeaCodie/TeaCodie-Website.git/info/refs not found: did you run git upd ...

  9. 算法笔记_156:算法提高 6-17复数四则运算(Java)

    目录 1 问题描述 2 解决方案   1 问题描述 设计复数库,实现基本的复数加减乘除运算. 输入时只需分别键入实部和虚部,以空格分割,两个复数之间用运算符分隔:输出时按a+bi的格式在屏幕上打印结果 ...

  10. Python 访问dict

    访问dict 1:可以if判断元素是否存在 2:dict.get('key')我们已经能创建一个dict,用于表示名字和成绩的对应关系:d = { 'Adam': 95, 'Lisa': 85, 'B ...