大家好!
我在尝试测试游戏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)