相关疑难解决方法(0)

C Typedef - 不完整类型

所以,出乎意料的是,编译器决定吐面:"现场客户的类型不完整".

这是相关的代码片段:

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 */
Run Code Online (Sandbox Code Playgroud)

customer.h

customer.h的头文件

#include <stdlib.h>
#include <string.h>

#ifndef CUSTOMER_H
#define CUSTOMER_H

    typedef struct CustomerStruct Customer;

    /* Function prototypes here */

#endif
Run Code Online (Sandbox Code Playgroud)

这是我的问题所在:

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 …
Run Code Online (Sandbox Code Playgroud)

c struct typedef header-files incomplete-type

8
推荐指数
2
解决办法
4万
查看次数

标签 统计

c ×1

header-files ×1

incomplete-type ×1

struct ×1

typedef ×1