So, unexpectedly, the compiler decides to spit on his face: "The field client is of an incomplete type."
Here are the relevant code snippets:
customer.c
#include <stdlib.h> #include <string.h> #include "customer.h" struct CustomerStruct; typedef struct CustomerStruct { char id[8]; char name[30]; char surname[30]; char address[100]; } Customer ; /* Functions that deal with this struct here */
customer.h
Header file for customer.h
#include <stdlib.h> #include <string.h> #ifndef CUSTOMER_H #define CUSTOMER_H typedef struct CustomerStruct Customer; #endif
This is where my problem is:
customer_list.c
#include <stdlib.h> #include <string.h> #include "customer.h" #include "customer_list.h" #include "..\utils\utils.h" struct CustomerNodeStruct; typedef struct CustomerNodeStruct { Customer customer; /* Error Here*/ struct CustomerNodeStruct *next; }CustomerNode; struct CustomerListStruct; typedef struct CustomerListStruct { CustomerNode *first; CustomerNode *last; }CustomerList; /* Functions that deal with the CustomerList struct here */
This source file has a customer_list.h header file, but I don't think it matters.
My problem
In customer_list.c, in the line with the comment /* Error Here */ , the compiler complains about the field customer has incomplete type.
I have been working on this problem all day, and now I am going to pull out my eyeballs and mix them with strawberries.
What is the source of this error?
Thanks in advance:)
[PS if I forgot something, let me know. It was a busy day for me, as you might say]
source share