incomplete type is not allowed
keil环境下,报错#70: incomplete type is not allowed,解决
mqtt_conf.h 定义了一个结构体
mqtt_buffer.h
#include <stdint.h>
#include "mqtt.h"
定义了一个结构体
struct MqttBuffer
{
struct MqttExtent *first_ext;
struct MqttExtent *last_ext;
uint32_t available_bytes;
char **allocations;
char *first_available;
uint32_t alloc_count;
uint32_t alloc_max_count;
uint32_t buffered_bytes;
};
c.h
#include <stdint.h>
#include <time.h>
#include "mqtt_conf.h"
#include "mqtt_buffer.h"
定义了一个结构体
struct MqttSampleContext
{
uint32_t sendedbytes;
struct MqttBuffer mqttbuf[1];
struct MqttContext mqttctx[1];
const char *proid;
const char *devid;
const char *apikey;
int dup;
enum MqttQosLevel qos;
int retain;
uint32_t publish_state;
uint16_t pkt_to_ack;
char cmdid[MQTT_LEN_MAX];
};
编译报错如下:
..\User\mqtt.h(189): error: #70: incomplete type is not allowed
struct MqttBuffer mqttbuf[1];
搜索了很多文章,没有找到原因。
后来 受到下面这个链接的启发,原来在mqtt_buffer.h 多了#include "mqtt.h"。原来在a.h里的内容比较少,我将内容搬到mqtt.h里了,所以才加了这句。恢复回去,就好了。
http://zhidao.baidu.com/link?url=HTiXra-5HCPCfj0_VleRYX5s9aDKBLnZjRBOEahUDPMF6u2CYBJ2yuxlaXIZZfihkRl1eWPUJZE-9JAXcmzrZq
结论,#include 的文件之间最好是单向的关系。在功能划分的时候,应尽量避免这个问题。keil的c跟标准的c似乎有些区别,很多时候没用 extern关键字反而没啥问题。
incomplete type is not allowed的更多相关文章
- ifstream:incomplete type is not allowed
IntelliSense: incomplete type is not allowed ifstream inputFile; Need to add this: #include <fstr ...
- incomplete type is not allowed ofstream
错误: incomplete type is not allowed 解决方案: #include<fstream>
- keil中error: #70: incomplete type is not allowed—解决方法
今天在写程序的时候,想使用sizeof求数组的大小,数组中其他c文件定义,在头文件使用extern uint8_t buff_value[]; 声明 但是keil编译报错,网上查了,发现,需要写成ex ...
- 关于编译报错“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 ...
- error: variable '__this_module' has initializer but incomplete type错误解决
版权所有,转载必须说明转自 http://my.csdn.net/weiqing1981127 原创作者:南京邮电大学 通信与信息系统专业 研二 魏清 问题描述:使用SAM9X25 内核版本是2. ...
- error “base class has incomplete type”
error "base class has incomplete type" 如果base.h是你的基类,那么在子类derive中,写成如下形式: class base; clas ...
- 错误:variable `xxx' has initializer but incomplete type
错误:variable `xxx' has initializer but incomplete type 原因:xxx对应的类型没有找到,只把xxx声明了但是没给出定义.编译器无从确认你调用的构造函 ...
随机推荐
- AOP之拦截函数调用链实现
AOP之拦截函数调用链实现 定义函数A,B,C,调用A->B->C,这样就形成了函数静态调用链,而AOP要做的是能动态的添加多个B,形成A->B1->B2->B3...- ...
- 【2013Esri全球用户大会精彩案例】Horry Count GIS--南卡罗来那州霍里县企业级应用
行业领域:政府 基于Online的组织机构订阅服务,构建Horry县的地图及应用门户,满足政府和公众的需要.公众可通过移动设备查看公开的地图,包括教育资源分布.选区分布.墓地管理.害虫监控等内容:政府 ...
- Citrix 服务器虚拟化之四 Xenserver资源池
Citrix 服务器虚拟化之四 Xenserver资源池 台主机,尽管这种限制没有执行.池总是至少有一个物理节点,称为主.只有主节点公开管理界面(使用XenCenter和XenServer命令行界面 ...
- Android Device Chooser中显示Target unknown解决方法
手机插在电脑上准备调试程序来着,通过eclipse运行时,弹出的Android Device Chooser中显示设备名是?????,Target未知,无法继续运行. 可以通过以下步骤解决(Ubunt ...
- Linux文件系统十问,你知道吗?
关于文件系统,相信大家都不陌生.身为攻城狮的我们几乎天天都会与之打交道,但是细深剖一下,其中又有多少是我们理解深度不够的呢.那么让我们一起来看一下下面这一组Linux文件系统相关的问题吧: 1.机械磁 ...
- JS —— 数组与字符串方法
数组 1. 基本方法 1)Array.prototype.unshift(item1,item2,item3...) 描述: 在数组的前面添加元素,一次可以传入多个参数. 注意:元素会根据当前传入的 ...
- js区分汉字和字符,校验长度
遇到这么一个问题, 长度限制输入150个英文字符(小于等于150个英文字符长度),超出则直接禁止输入,并提醒:摘要输入必须小于等于75个中文字符长度! 长度校验倒是没问题,但是要区分汉字还是英文 ...
- 蓝桥杯 C语言 入门训练 序列求和
问题描述 求1+2+3+...+n的值. 输入格式 输入包括一个整数n. 输出格式 输出一行,包括一个整数,表示1+2+3+...+n的值. 样例输入 4 样例输出 10 样例输入 100 说明:有一 ...
- Mybatis学习笔记(三) 之Dao开发
使用Mybatis开发Dao,通常有两个方法,即原始Dao开发方法和Mapper接口开发方法,常用还是Mapper接口开发. SqlSession的使用范围 public class test1 { ...
- Mac下使用charles遇到的问题以及解决办法
最近使用上了Charles,因为之前一直使用Fidder,所以还是碰到了一些问题,这里记录一下. 如何安装破解版 打开charles后,发现访问但是抓不到包 抓取HTTPS的接口,看response是 ...