小编Shu*_*yon的帖子

错误:在C中,在结构指针中得到错误"取消引用指向不完整类型的指针"

大家好!

我在尝试测试游戏Clever Frog的代码时遇到以下错误: 错误:取消引用指向不完整类型的指针

'完整代码'位于pastebin.com - 此处(不会过期).但我认为,通过下面的解释,任何人都可以理解.注意:我还没有实现将擦除分配的内存和其他东西的功能.

我在1.c文件中定义了一个结构:

#include "1.h"
...
struct test {
   int a;
   };
...
Run Code Online (Sandbox Code Playgroud)

我有一个1.h wicth有typedef使用它:

...
typedef struct test testT;
...
Run Code Online (Sandbox Code Playgroud)

然后我有一个函数,其中有一个参数取决于testT,它在2.c:

...
void funcTest(testT **t, int *size, ..){
   /* another function that creates mem.space/alocate memory based enter code here`on the need of size above */
   createMem(t,*size); /* void createMem(testT **t, int size); */

   t[0]->a = 0; /*ERROR HERE*/
   /* ... more code ... */
}
...
Run Code Online (Sandbox Code Playgroud)

2.h文件是这样的:

...
void funcTest(testT **t, int *size, …
Run Code Online (Sandbox Code Playgroud)

c struct pointers header dereference

3
推荐指数
1
解决办法
4万
查看次数

标签 统计

c ×1

dereference ×1

header ×1

pointers ×1

struct ×1