错误:variable `xxx' has initializer but incomplete type 
原因:xxx对应的类型没有找到,只把xxx声明了但是没给出定义。编译器无从确认你调用的构造函数是什么,在哪儿
一般是没有包含定义xxx的头文件。

比如:

     MyClass theObj;
const QMetaObject* metaObj = theObj.metaObject();
//1.遍历类的属性
int propertyCnt = metaObj->propertyCount();
for ( int i = ; i < propertyCnt; ++ i )
{
QMetaProperty oneProperty = metaObj->property(i);
std::cout << " name: " << oneProperty.name();
std::cout << " type: " << QVariant::typeToName( oneProperty.type()) << "\n";
}

不包含头文件的话会报一下错误:

使用#include <QMetaProperty>即可。

variable `xxx' has initializer but incomplete type的更多相关文章

  1. 错误:variable `xxx' has initializer but incomplete type

    错误:variable `xxx' has initializer but incomplete type 原因:xxx对应的类型没有找到,只把xxx声明了但是没给出定义.编译器无从确认你调用的构造函 ...

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

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

  3. variable 'QJsonArray array' has initializer but incomplete type

    variable "xxx" has initializer but incomplete type 编译报以上错误 分析:“xxx”对应的类型没有找到,没包含定义该变量类型的头文 ...

  4. 【转】The final local variable xxx cannot be assigned, since it is defined in an enclosing type

    文地址:http://blog.163.com/benben_long/blog/static/199458243201481102257544/ 本文就自己编程时候遇到的一个问题,简要描述一下,并提 ...

  5. 关于编译报错“dereferencing pointer to incomplete type...

    今天同事问了我一个问题,他make的时候报错,“第201行:dereferencing pointer to incomplete type”,我随即查阅了很多资料,也没看出个所以然.最后问题得到了解 ...

  6. mysql编译时报的一个警告warning: type-punning to incomplete type might break strict-aliasing rules,可能是bug

    cmake的时候报了一个警告: /softdb/mysql-5.5.37/storage/innobase/handler/ha_innodb.cc:11870: warning: type-punn ...

  7. 编译报错dereferencing pointer to incomplete type

    关于编译报错“dereferencing pointer to incomplete type... 多是没找到结构体的定义,可以在本地复制其定义试试. 参考: http://my.oschina.n ...

  8. local variable 'xxx' referenced before assignment

    这个问题很囧,在外面定义了一个变量 xxx ,然后在python的一个函数或类里面引用这个变量,并改变它的值,结果报错local variable 'xxx' referenced before as ...

  9. error “base class has incomplete type”

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

随机推荐

  1. AME_PR采购申请单通过AME审批设定和测试(案例)

    2014-06-21 Created By BaoXinjian

  2. Spring Boot返回json数据及完美使用FastJson解析Json数据

     Spring Boot返回json数据 视频地址:http://www.iqiyi.com/w_19rubxzsr5.html 博文参考:https://blog.csdn.net/linxingl ...

  3. 开发Yii2过滤器并通过behaviors()行为调用(转)

    在Yii2的几乎每个controller中,我们都会看到一个函数behaviors(),通常,我们用这个函数来配置控制器的权限,例如:public function behaviors()    {  ...

  4. jenkins 构建执行jmeter测试流程

    性能测试使用maven工程说明1.依赖尽量用maven依赖管理2.添加jmeter maven依赖 <dependency> <groupId>org.apache.jmete ...

  5. unity 显示帧率

    Game视图右上角Stats按钮按下即可显示统计信息.

  6. Hadoop: Setup Maven project for MapReduce in 5mn

    Hadoop: Setup Maven project for MapReduce in 5mn 25 MAY 2013 / ANTOINE AMEND I am sure I am not the ...

  7. nginx是以多进程的方式来工作的

    nginx是以多进程的方式来工作的. nginx在启动后,会有一个master进程和多个worker进程. master进程主要用来管理worker进程: 包含: 1.接收来自外界的信号,向各work ...

  8. Oracle中查询表字段基本信息、主键、外键(整理)

    背景 因为项目某些模块的数据结构设计没有严格按照某规范设计,所以只能从数据库中查询数据结构,需要查询的信息如下:字段名称.数据类型.是否为空.默认值.主键.外键等等. 在网上搜索了查询上述信息的方法, ...

  9. Racket 版本的 24 点实现

    Racket 版本的 24 点实现 #lang racket ; Author: woodfox ; Date: Oct 11, 2014 ; ==================== 1. Non- ...

  10. RhinoMock初探

    官方wiki:http://www.ayende.com/wiki/Rhino+Mocks.ashx ========================================= 接口Mock: ...