そのため、突然、コンパイラはこれに直面して吐き出すことにしました:「フィールドの顧客には不完全な型があります」。
関連するコードのスニペットは次のとおりです。
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 */
顧客.h
customer.h のヘッダー ファイル
#include <stdlib.h>
#include <string.h>
#ifndef CUSTOMER_H
#define CUSTOMER_H
typedef struct CustomerStruct Customer;
/* Function prototypes here */
#endif
これが私の問題です:
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 */
このソース ファイルにはヘッダー ファイル customer_list.h がありますが、関連性はないと思います。
私の問題
customer_list.c の comment のある行で/* Error Here */
、コンパイラは次のように文句を言いますfield customer has incomplete type.
私は一日中この問題をグーグルで調べていましたが、今は眼球を取り出してイチゴとブレンドするところです.
このエラーの原因は何ですか?
前もって感謝します :)
[追記: 言い忘れがありましたら、お知らせください。あなたが言うかもしれないように、それは私にとってストレスの多い日でした]