急急急,求大神解决结构体问题!!!
发表在C语言图书答疑
2013-06-11
是否精华
是
否
版块置顶:
是
否
我在一个文件中定义结构体
typedef struct
{
char name[20]; //地点名称
int code; //地点代号
char introduction[50]; //地点信息
}Place;
typedef struct
{
Place list[MaxSize];
int size;
}SeqList;
在另一个文件中定义了结构体
#include"SeqList.h"
typedef struct
{
SeqList Vertices;
int edge[MaxVertices][MaxVertices];
int numOfEdges;
}AdjMGraph;
为什么报错,下面是一部分报错:
error: `Place' does not name a type
error: 'struct SeqList' has no member named 'list'
error: 'struct SeqList' has no member named 'list'
error: 'struct SeqList' has no member named 'list'
error: conflicting declaration 'typedef struct SeqList SeqList'
error: 'SeqList' has a previous declaration as `typedef struct SeqList SeqList'
typedef struct
{
char name[20]; //地点名称
int code; //地点代号
char introduction[50]; //地点信息
}Place;
typedef struct
{
Place list[MaxSize];
int size;
}SeqList;
在另一个文件中定义了结构体
#include"SeqList.h"
typedef struct
{
SeqList Vertices;
int edge[MaxVertices][MaxVertices];
int numOfEdges;
}AdjMGraph;
为什么报错,下面是一部分报错:
error: `Place' does not name a type
error: 'struct SeqList' has no member named 'list'
error: 'struct SeqList' has no member named 'list'
error: 'struct SeqList' has no member named 'list'
error: conflicting declaration 'typedef struct SeqList SeqList'
error: 'SeqList' has a previous declaration as `typedef struct SeqList SeqList'