主题:[求助] 函数重复定义 各位帮忙纠错 谢谢
函数定义如下
------------------------------------------------------------------
//file StuManage.h
typedef struct
{
char StuID[10]; //学生学号
char StuName[20]; //学生姓名
char StuClass[5]; //学生所在班号
}STU_DATA;
typedef struct
{
STU_DATA data;
struct STU_NODE *pNext; //指向下一个学生的指针
SCO_NODE *pScoHead; //指向该生成绩的头指针
}STU_NODE , *pSTU_NODE;
-------------------------------------------------------------------
//file ClassManage.h
#include "StuManage.h"
typedef struct //班级数据基本结构
{
char ClassID[5]; //班级编号
char ClassName[10]; //班级名称
}CLASS_DATA;
typedef struct //班级链表节点结构
{
CLASS_DATA data;
struct CLASS_NODE *pNext; //指向下一个班级的指针
STU_NODE *pStuHead; //指向该班学生的头指针
}CLASS_NODE , *pCLASS_NODE;
--------------------------------------------------------------------
//file ScoManage.h
#include <stdio.h>
#include <iostream.h>
#include <stdlib.h>
#include <malloc.h>
typedef struct
{
char CourseName[10]; //课程名称
char CourseScore[5]; //课程成绩
}SCO_DATA;
typedef struct
{
SCO_DATA data;
struct SCO_NODE *pNext; //指向下一个成绩的指针
}SCO_NODE, *pSCO_NODE;
-------------------------------------------------------------------
main.cpp 中 #include "ClassManage.h"
ClassManage.cpp 中 #include "ClassManage.h"
StuManage.cpp 中 #include "StuManage.h"
ScoManage.cpp 中 #include "ScoManage.h"
编译时出现
j:\datastructure\stumanage\scoremanage.h(18) : error C2371: 'SCO_NODE' : redefinition; different basic types
j:\datastructure\stumanage\scoremanage.h(17) : see declaration of 'SCO_NODE'
j:\datastructure\stumanage\stumanage.h(16) : error C2371: 'STU_NODE' : redefinition; different basic types
j:\datastructure\stumanage\stumanage.h(14) : see declaration of 'STU_NODE'
j:\datastructure\stumanage\classmanage.h(15) : error C2371: 'CLASS_NODE' : redefinition; different basic types
j:\datastructure\stumanage\classmanage.h(13) : see declaration of 'CLASS_NODE'
它说的是重复定义,可是小弟确实找不出来,汗颜啊……
希望大家帮帮我,谢谢!
------------------------------------------------------------------
//file StuManage.h
typedef struct
{
char StuID[10]; //学生学号
char StuName[20]; //学生姓名
char StuClass[5]; //学生所在班号
}STU_DATA;
typedef struct
{
STU_DATA data;
struct STU_NODE *pNext; //指向下一个学生的指针
SCO_NODE *pScoHead; //指向该生成绩的头指针
}STU_NODE , *pSTU_NODE;
-------------------------------------------------------------------
//file ClassManage.h
#include "StuManage.h"
typedef struct //班级数据基本结构
{
char ClassID[5]; //班级编号
char ClassName[10]; //班级名称
}CLASS_DATA;
typedef struct //班级链表节点结构
{
CLASS_DATA data;
struct CLASS_NODE *pNext; //指向下一个班级的指针
STU_NODE *pStuHead; //指向该班学生的头指针
}CLASS_NODE , *pCLASS_NODE;
--------------------------------------------------------------------
//file ScoManage.h
#include <stdio.h>
#include <iostream.h>
#include <stdlib.h>
#include <malloc.h>
typedef struct
{
char CourseName[10]; //课程名称
char CourseScore[5]; //课程成绩
}SCO_DATA;
typedef struct
{
SCO_DATA data;
struct SCO_NODE *pNext; //指向下一个成绩的指针
}SCO_NODE, *pSCO_NODE;
-------------------------------------------------------------------
main.cpp 中 #include "ClassManage.h"
ClassManage.cpp 中 #include "ClassManage.h"
StuManage.cpp 中 #include "StuManage.h"
ScoManage.cpp 中 #include "ScoManage.h"
编译时出现
j:\datastructure\stumanage\scoremanage.h(18) : error C2371: 'SCO_NODE' : redefinition; different basic types
j:\datastructure\stumanage\scoremanage.h(17) : see declaration of 'SCO_NODE'
j:\datastructure\stumanage\stumanage.h(16) : error C2371: 'STU_NODE' : redefinition; different basic types
j:\datastructure\stumanage\stumanage.h(14) : see declaration of 'STU_NODE'
j:\datastructure\stumanage\classmanage.h(15) : error C2371: 'CLASS_NODE' : redefinition; different basic types
j:\datastructure\stumanage\classmanage.h(13) : see declaration of 'CLASS_NODE'
它说的是重复定义,可是小弟确实找不出来,汗颜啊……
希望大家帮帮我,谢谢!