我正在做家庭作業。家庭作業錯誤:取消引用指向不完整類型的指針
我在這個任務中遇到了標題錯誤。從我目前看到的內容來看,我知道結構定義在某處存在問題,但由於這是由我的教授完成的,所以我傾向於認爲這與我調用結構的方式有關。 這裏是相關的代碼。
main.c中(其中我發現了從錯誤中):
#include "processes.h"
//...
Processes * proc = proc_create(filename); //line 90
// the struct I'm trying to create
//...
for(i = 0; i < proc->size; i++) // line 100, where I get the first error of
// dereferencing pointer to an incomplete type
{
//Some code
}
在processes.c(其中結構進程的定義):在processes.h
struct Processes{
struct Proc *array; // array of Processes
int internal_size; // how big the array is total
int size; // how many valid Procs in the array
};
:
typedef struct Processes Processes;
// Create your Processes struct using the filename of a schedule.txt
Processes * proc_create(char *filename);
如果有人可以請向我解釋一下,這個錯誤的意思是什麼,並指出我在正確的方向fi興它,這將不勝感激!此外,如果您需要其他任何內容,我很樂意發佈其他代碼。我很確定這是相關的代碼。
將您的'struct Processes'的定義從您的源文件移動到您的標題。 –