错误: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. MySQL Cluster 具体配置文件(config.ini)

    ########################################################################### ## MySQL CLuster 配置文件 ## ...

  2. Windows 7 64bit上安装Oracle Database 12c [INS-30131] 错误的解决方法

    Windows 7 64bit上安装Oracle Database 12c,出现以下错误: 解决方法: 第一步:控制面板>所有控制面板项>管理工具>服务>SERVER  启动 ...

  3. 查看mysql日志

    1.首先确认你日志是否启用了 MySQL>show variables like 'log_bin'; 2.如果启用了,即ON那日志文件就在MySQL的安装目录的data目录下 3.怎样知道当前 ...

  4. js判断字符串str是否包含字符串substr

    js判断字符串str是否包含字符串substr: function addUser(id,realName){ var userids = $("#userids").val(); ...

  5. 从github上下载项目到eclipse

    第一步:把代码下载到本地的仓库中 到github后选择自己想下载的项目,拷贝它的URL,图示如下: 进入eclipse中  点击后如下:  继续 按照图片指示继续(大白菜next教程)     fin ...

  6. linux shell 命令获取字符串/文件的MD5值

    获取字符串的MD5值: 字符串“hello”的MD5: $ echo -n 'hello'|md5sum|cut -d ' ' -f1 得到的MD5值: 5d41402abc4b2a76b9719d9 ...

  7. Java:多线程,线程池,ThreadPoolExecutor详解

    1. ThreadPoolExecutor的一个常用的构造方法 ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepA ...

  8. mybatis 一二事(2) - 动态代理

    db.properties 单独提取出来的数据库配置,方便以后维护管理 jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhos ...

  9. gitlab人备份与恢复

    注意新建备份目录是:/usr/local/src/repositories 属主和属组: # ll -d repositories/ drwx------ git root Feb : reposit ...

  10. Ubantu MySQL数据库操作

    用户管理: 1.新建用户: >CREATE USER name IDENTIFIED BY 'ssapdrow'; 2.更改密码: >SET PASSWORD FOR name=PASSW ...