我的其中一个头文件Quee.h有一个结构,在另一个文件with ing.h中定义了一个结构。H包括vice ing.h,但反之亦然。编译器gcc告诉我这个结构是一个不完整的类型。项目中的多个文件都包含这两个文件,但我确保它们首先包含路径h。我看过一些有同样问题的帖子,但它们似乎是由前瞻性声明或循环收录引起的。据我所知我不是。
queue.h
#include "pathing.h"
typedef struct _queue{
struct queue* below;
struct point_t value;
}queue;
point_t pop(queue* a);
point_t peek(queue a);
void add(queue* a, point_t pointer);pathing.h
#ifndef _pathing_
#define _pathing_
typedef unsigned char byte_t;
typedef struct _point_t{
int x;
int y;
}point_t;
int exec(int argc,char* arg[]);
#endifP.S.我是C的新手,正在自学,所以如果这些代码中有任何一个风格不好,或者可以做得更容易,请告诉我。
发布于 2015-10-01 04:59:50
typedef struct _queue{
// This is a typo. You are missing the _ before queue.
// struct queue* below;
struct _queue* below;
struct point_t value;
}queue;关于point_t,代码中没有struct point_t这样的东西。您可以使用:
struct _point_t value; 或
point_t value;https://stackoverflow.com/questions/32879737
复制相似问题