错误: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. Python tuple 函数

    描述 Python 元组 tuple() 函数将列表转换为元组. 语法 以下是 tuple 的语法: tuple( seq ) 参数 seq -- 要转换为元组的序列. 返回值 返回元组. 实例 以下 ...

  2. __align

    __align关键字指示编译器在n字节边界上对齐变量. __align是一个存储类修饰符.它不影响函数的类型. 语法 __align(n) 其中:  n是对齐边界. n可以具有值1.2.4或者8. _ ...

  3. JAVA多线程和并发基础面试问答【转】

    JAVA多线程和并发基础面试问答 多线程和并发问题是Java技术面试中面试官比较喜欢问的问题之一.在这里,从面试的角度列出了大部分重要的问题,但是你仍然应该牢固的掌握Java多线程基础知识来对应日后碰 ...

  4. 怎么从docker中copy文件到 本机

    怎么从docker中copy文件到 本机 docker cp <containerId>:/file/path/within/container /host/path/target

  5. [Jobdu] 题目1214:丑数

    题目描述: 把只包含因子2.3和5的数称作丑数(Ugly Number).例如6.8都是丑数,但14不是,因为它包含因子7.习惯上我们把1当做是第一个丑数.求按从小到大的顺序的第N个丑数. 输入: 输 ...

  6. Lua脚本语言快速入门手册

    学了两天Lua语言,感叹其短小精悍,上手极快,语法还很舒服,不错!整理下学习过程中经常用到的基础知识,共勉! Lua用法简述 Lua语言是在1993年由巴西一个大学研究小组发明,其设计目标是作为嵌入式 ...

  7. Viso Professional 2013版本激活(office 系列产品 -- visio 2013 / project 2013 破解工具 - KMSpico)

    背景: 环境是 win7, 64 bit 装了 visio 2013 , 可以却不能用它来画图,在网上找了一些破解工具,大都不能解决问题.网上不靠谱的广告型文章太多了,比较头痛. 所幸,终于找到正确的 ...

  8. spring bean autowire自动装配

    转自:http://blog.csdn.net/xiao_jun_0820/article/details/7233139 autowire="byName"会自动装配属性与Bea ...

  9. Qt creator 编译错误:无法解析的外部符号(命令)

    问题来自于:仅仅是在creator 中加入了一个新的DIalog类,并在main(),中实例化并show.就出现例如以下的错误: main.obj:-1: error: LNK2019: 无法解析的外 ...

  10. Set 集合论

    https://en.m.wikipedia.org/wiki/De_Morgan%27s_laws https://plato.stanford.edu/entries/set-theory/ ht ...