错误: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. 管道读写规则和Pipe Capacity、PIPE_BUF

    一.当没有数据可读时 O_NONBLOCK disable:read调用阻塞,即进程暂停执行,一直等到有数据来到为止. O_NONBLOCK enable:read调用返回-1,errno值为EAGA ...

  2. Linux标识进程

    一.前言 其实两年前,本站已经有了一篇关于进程标识的文档,不过非常的简陋,而且代码是来自2.6内核.随着linux container.pid namespace等概念的引入,进程标识方面已经有了天翻 ...

  3. 修改oracle数据库的编码为utf-8

    1.查看数据库字符集 ? 数据库服务器字符集select * from nls_database_parameters,其来源于props$,是表示数据库的字符集. 客户端字符集环境select * ...

  4. 项目打成jar包

    distributionManagement 为发布到本地参考的地址 repository 设置从本地maven库拉取jar包 <project xmlns:xsi="http://w ...

  5. PHP利用MySQL保存session(php5.4之前的处理)

    简介 使用MySQL保存session,需要保存三个关键性的数据:session id.session数据.session生命期. 考虑到session的使用方式,没必要使用InnoDB引擎,MyIS ...

  6. Java web中listener、 filter、servlet 加载顺序

    真正的加载顺序为:context-param -> listener -> filter -> servlet 加载顺序与它们在 web.xml 文件中的先后顺序无关.即不会因为 f ...

  7. CentOS6.4之图解SSH无验证双向登陆配置

    配置SSH无登陆验证,在很多场景下是非常方便的,尤其是在管理大型集群服务时,避免了繁琐的密码验证,在安全级别越高的服务器上,通常密码的设置更复杂,配置SSH,不仅可以用密钥保证节点间通信的安全性,同时 ...

  8. 自己写的一个操作Mysql的简单的实例

    #include <WinSock.h> #include <stdio.h> #include <iostream> #include <windows.h ...

  9. Oracle Study之-AIX6.1构建Oracle 10gR2 RAC(3)

    Oracle Study之-AIX6.1构建Oracle 10gR2 RAC(3) 一.配置共享存储 [oracle@aix203 ~]$lsdev -c disk hdisk0 Available ...

  10. Python框架级编程的能力要求

    说在前面:比较基础的就不说 1.装饰器熟练掌握 2.内建函数,内建变量.下划线函数之类的东西要搞明白 3.一定Python数据接口和算法实现能力 4.内省 5.元编程