错误: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. Android 加新的页面

    工程右键->New->Other->Android Activity

  2. Dockerfile最佳实践(一)

    1.使用缓存  Dockerfile的每条指令都会将结果提交为新的镜像,下一跳指令将会基于上一步指令的镜像的基础上构建,如果一个镜像存在相同的父镜像和指令(除了ADD),Docker将会使用镜像而不是 ...

  3. PCIE知识点

    引自:http://bbs.eetop.cn/thread-442072-1-1.html 1.从速度上来讲PCIE1.0标准 2.5G(8B/10B),pcie2.0标准 5.0G(8B/10B)p ...

  4. 【Android】21.3 动画

    分类:C#.Android.VS2015: 创建日期:2016-03-21 一.简介 Android 提供了以下三种创建动画的方式: Drawable Animations – 画板动画,也叫帧动画( ...

  5. 【Android】12.0 第12章 Intent及其过滤器—本章示例主界面

    分类:C#.Android.VS2015: 创建日期:2016-02-23 一.简介 这一章我们主要学习Intent的基本用法,并通过例子演示如下功能: 如何启动另一个界面: 如何获取另一个界面的返回 ...

  6. 【Android】3.10 热力图功能

    分类:C#.Android.VS2015.百度地图应用: 创建日期:2016-02-04 一.简介 热力图是用不同颜色的区块叠加在地图上描述人群分布.密度和变化趋势的一个产品,可利用自有数据,构建属于 ...

  7. 使用VMware安装CentOS7步骤详情

    准备资料: CentOS-7-x86_64-Everything-1611 点击下载CentOS 对,资料就这些 第一步.  点击文件  再点击新建虚拟机 第二步 .点击完新建虚拟机之后会跳出一个窗口 ...

  8. Django视图之URLconfs

    对于一个web程序而言,接收和处理用户的请求并返回响应是一个最基本的.也是最重要的功能. Django为这个功能取了一个好听的名字——“视图”. 而具体的代码实现往往是通过一个个函数,Django中也 ...

  9. NAND FLASH驱动程序

    NAND FLASH是一个存储芯片那么: 这样的操作很合理"读地址A的数据,把数据B写到地址A" 问1. 原理图上NAND FLASH和S3C2440之间只有数据线,     怎么 ...

  10. div层上下左右居中

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...