天天看点

keil中error: #70: incomplete type is not allowed——已解决!

    今天改写程序,,在b.c文件中需要引入一个a.c中的结构体变量,,我在b.c中直接extern 这个结构体,,结果编译时报错error: #70: incomplete type is not allowed最后上网查找才知道结构体不能这样引入。。

    正确的引入方法是;

    1.在a.h中声明这个结构体,,(结构体实体要在.h文件中)

    2.在a.c中定义这个结构体类型的变量。(也可以在a.h中定义结构体变量)

    3.在b.c中ertern引入这个结构体变量

    当ertern一个数组时如果不定义数组大小是也会出现error: #70: incomplete type is not allowed这个错误。。

    正确引入数组:

    ertern char a[10];

继续阅读