variable `xxx' has initializer but incomplete type
错误: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的更多相关文章
- 错误:variable `xxx' has initializer but incomplete type
错误:variable `xxx' has initializer but incomplete type 原因:xxx对应的类型没有找到,只把xxx声明了但是没给出定义.编译器无从确认你调用的构造函 ...
- error: variable '__this_module' has initializer but incomplete type错误解决
版权所有,转载必须说明转自 http://my.csdn.net/weiqing1981127 原创作者:南京邮电大学 通信与信息系统专业 研二 魏清 问题描述:使用SAM9X25 内核版本是2. ...
- variable 'QJsonArray array' has initializer but incomplete type
variable "xxx" has initializer but incomplete type 编译报以上错误 分析:“xxx”对应的类型没有找到,没包含定义该变量类型的头文 ...
- 【转】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/ 本文就自己编程时候遇到的一个问题,简要描述一下,并提 ...
- 关于编译报错“dereferencing pointer to incomplete type...
今天同事问了我一个问题,他make的时候报错,“第201行:dereferencing pointer to incomplete type”,我随即查阅了很多资料,也没看出个所以然.最后问题得到了解 ...
- 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 ...
- 编译报错dereferencing pointer to incomplete type
关于编译报错“dereferencing pointer to incomplete type... 多是没找到结构体的定义,可以在本地复制其定义试试. 参考: http://my.oschina.n ...
- local variable 'xxx' referenced before assignment
这个问题很囧,在外面定义了一个变量 xxx ,然后在python的一个函数或类里面引用这个变量,并改变它的值,结果报错local variable 'xxx' referenced before as ...
- error “base class has incomplete type”
error "base class has incomplete type" 如果base.h是你的基类,那么在子类derive中,写成如下形式: class base; clas ...
随机推荐
- oc 类型判断
#import <UIKit/UIKit.h> #import "AppDelegate.h" @interface A : NSObject @end @implem ...
- Linux vm运行参数 - OOM相关的参数
一.前言 本文是描述Linux virtual memory运行参数的第二篇,主要是讲OOM相关的参数的.为了理解OOM参数,第二章简单的描述什么是OOM.如果这个名词对你毫无压力,你可以直接进入第三 ...
- nginx服务器下 PHP 出现 502 解决方案(转)
nginx出现502有很多原因,但大部分原因可以归结为资源数量不够用,也就是说后端PHP-fpm处理有问题,nginx将正确的客户端请求发给了后端的php-fpm进程,但是因为php-fpm进程的问题 ...
- js数组设置值操作
js中给数组中添加新值的方式: var flow=[]; for(var i=0;i<21;i++){ flow.push(Math.floor(Math.random()*(30+((i%12 ...
- jetty上传文件的时候报错显示文件过大
这个时候我们需要修改jetty的参数文件 cd /data/java_web_app/news23456/etc vim jetty.xml 找到这一行 <Configure id=" ...
- Windows环境下文件的彻底删除与恢复,推荐几个工具(整理)
1. 背景 在Windows(从XP到Win7)中删除文件时,无论是Delete或者是Shift+Delete,都不能真正的删除文件,它做的事情只是从文件分配表中删除了该文件的信息,而并未将文件从存储 ...
- 【转】使用create_project.py创建cocos2d项目时出错
命令格式:create_project.py -project 项目名字 -package 包名 -language cpp,例如: create_project.py -project HelloC ...
- openvpn中tun和tap的区别
openvpn有dev tun和dev tap模式的区别,cookbook的解释是:A TUN device is used mostly for VPN tunnels where only IP- ...
- js获取当前页面url网址等信息
使用js获取当前页面的url网址信息. 1.设置或获取整个 URL 为字符串: window.location.href 2.设置或获取与 URL 关联的端口号码: window.location.p ...
- HTML5背景音乐的暂停与播放
HTML代码: <audio id="myaudio" loop="loop" preload="auto" autoplay ...