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声明了但是没给出定义.编译器无从确认你调用的构造函 ...
随机推荐
- 把虚拟机中的Linux系统安装到U盘中
[小技巧] 把虚拟机中的Linux系统安装到U盘中 出于各种需求,很多用户可能经常会在Windows系统中安装虚拟机,然后在虚拟机中安装Linux系统.使用虚拟机的优点是可以同时使用多个系统,而缺点也 ...
- Java-继承的应用
class array { private int[] temp; private int foot; public array(int len) //为temp数组规定大小,并开辟空间,申 ...
- Memcached 学习笔记(二)——ruby调用
Memcached 学习笔记(二)——ruby调用 上一节我们讲述了怎样安装memcached及memcached常用命令.这一节我们将通过ruby来调用memcached相关操作. 第一步,安装ru ...
- go: GOPATH entry is relative; must be absolute path: "".
安装:vscode-go出现以下提示: go: GOPATH entry is relative; must be absolute path: "".Run 'go help g ...
- Hexo站点之域名配置
摘要 因为Hexo个人博客是托管在github之上,每次访问都要使用githubname.github.io这么一个长串的域名来访问,会显得非常繁琐.这个时候我们可以购买一个域名,设置DNS跳转,以达 ...
- 使用 IDEA 创建 Maven Web 项目 (四)- 让 WEB 应用跑起来
在 IDEA 中配置 Tomcat 单击 IDEA 工具栏上的 Edit Configurations... (在一个下拉框中),弹出 Run/Debug Configurations 对话框. 单击 ...
- swift设置textfield边框颜色
//swift3.0,如果是2.0的话也可以照着这个样子去写,语法有所变动.根据联想出来的就可以了. let tx = UITextField(frame: CGRect(x: 100, y: 100 ...
- C语言之变量与常量的介绍
一 标示符 标识符:可以理解为是变量名.名字常量表示法的常量名,但是不仅限于这两个 命名规范: 1.起名要有意义,基本要做到一看名字就知道是用来干嘛的(要求你遵守,但不会报错,希望能够养成这样的好习惯 ...
- Scrapy框架安装配置小结
Windows 平台: 系统是 Win7 Python 2.7.7版本 官网文档:http://doc.scrapy.org/en/latest/intro/install.html 1.安装Pyt ...
- 正则表达式之邮箱验证javascript代码
fuchangxi的正则: 复制代码 代码如下: /^([0-9A-Za-z\-_\.]+)@([0-9a-z]+\.[a-z]{2,3}(\.[a-z]{2})?)$/g 开始必须是一个或者多个单词 ...