struct TODAY_BIT {
Uint16 MORNING:16;
Uint16 AFTERNOON:16;
};
union TODAY_REG{
Uint32 all;
struct TODAY_BIT bit;
};
我在头文件里写了上述两组结构,然后出现了如下的报错:
Description Resource Path Location Type
"TODAY_BIT" has already been declared in the current scope ECAN_T&R.h /BasedOnCan_M3_2_Eyior line 44 C/C++ Problem
Description Resource Path Location Type
"TODAY_BIT" has already been declared in the current scope ECAN_T&R.h /BasedOnCan_M3_2_Eyior line 44 C/C++ Problem
***************************************************************************************************************************************************
分割线
***************************************************************************************************************************************************
因为头文件里面的内容是自己写的,所以不存在重复定义的问题。至于为什么提示重复声明,我真的不知道。
求大神解答,这个问题困惑我很久了。
附头文件全部代码:
//###########################################################################
//
// FILE: Pepsi_wall.h
//
//###########################################################################
#define ECAN_R&T;
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************
* define a struct type for resister T and R
*******************************************/
struct WALL_BIT{
Uint16 rock0:16;
Uint16 rock1:16;
};
union WALL_REG{
Uint32 all;
struct WALL_BIT bit;
};
struct CLASSROOM_BIT{
union WALL_REG wall0;
union WALL_REG wall1;
};
/*********************************************/
/*******************************************
* define a struct type for resister T and R
*******************************************/
struct TODAY_BIT {
Uint16 MORNING:16;
Uint16 AFTERNOON:16;
};
union TODAY_REG{
Uint32 all;
struct TODAY_BIT bit;
};
/**********************************************/
/*******************************************
* define a struct type for order
*******************************************/
struct ORDER_BIT{
Uint16 order0:1;
Uint16 order1:1;
Uint16 order2:1;
Uint16 order3:1;
Uint16 order4:1;
Uint16 order5:1;
Uint16 order6:1;
Uint16 order7:1;
Uint16 order8:1;
Uint16 order9:1;
Uint16 order10:1;
Uint16 order11:1;
Uint16 order12:1;
Uint16 order13:1;
Uint16 order14:1;
Uint16 order15:1;
Uint16 order16:1;
Uint16 order17:1;
Uint16 order18:1;
Uint16 order19:1;
Uint16 order20:1;
Uint16 order21:1;
Uint16 order22:1;
Uint16 order23:1;
Uint16 order24:1;
Uint16 order25:1;
Uint16 order26:1;
Uint16 order27:1;
Uint16 order28:1;
Uint16 order29:1;
Uint16 order30:1;
Uint16 order31:1;
};
union ORDER_REG{
Uint32 all;
struct ORDER_BIT bit;
};
/*****************************************************************************************************************************/
完毕 求大神解答,这个问题困惑我很久了。
Linda:
您好!
请问定义好这两个结构体,使用这两个结构体是在哪个文件里?
在使用这两个结构体的文件里是否有做extern的声明?
struct TODAY_BIT {
Uint16 MORNING:16;
Uint16 AFTERNOON:16;
};
union TODAY_REG{
Uint32 all;
struct TODAY_BIT bit;
};
我在头文件里写了上述两组结构,然后出现了如下的报错:
Description Resource Path Location Type
"TODAY_BIT" has already been declared in the current scope ECAN_T&R.h /BasedOnCan_M3_2_Eyior line 44 C/C++ Problem
Description Resource Path Location Type
"TODAY_BIT" has already been declared in the current scope ECAN_T&R.h /BasedOnCan_M3_2_Eyior line 44 C/C++ Problem
***************************************************************************************************************************************************
分割线
***************************************************************************************************************************************************
因为头文件里面的内容是自己写的,所以不存在重复定义的问题。至于为什么提示重复声明,我真的不知道。
求大神解答,这个问题困惑我很久了。
附头文件全部代码:
//###########################################################################
//
// FILE: Pepsi_wall.h
//
//###########################################################################
#define ECAN_R&T;
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************
* define a struct type for resister T and R
*******************************************/
struct WALL_BIT{
Uint16 rock0:16;
Uint16 rock1:16;
};
union WALL_REG{
Uint32 all;
struct WALL_BIT bit;
};
struct CLASSROOM_BIT{
union WALL_REG wall0;
union WALL_REG wall1;
};
/*********************************************/
/*******************************************
* define a struct type for resister T and R
*******************************************/
struct TODAY_BIT {
Uint16 MORNING:16;
Uint16 AFTERNOON:16;
};
union TODAY_REG{
Uint32 all;
struct TODAY_BIT bit;
};
/**********************************************/
/*******************************************
* define a struct type for order
*******************************************/
struct ORDER_BIT{
Uint16 order0:1;
Uint16 order1:1;
Uint16 order2:1;
Uint16 order3:1;
Uint16 order4:1;
Uint16 order5:1;
Uint16 order6:1;
Uint16 order7:1;
Uint16 order8:1;
Uint16 order9:1;
Uint16 order10:1;
Uint16 order11:1;
Uint16 order12:1;
Uint16 order13:1;
Uint16 order14:1;
Uint16 order15:1;
Uint16 order16:1;
Uint16 order17:1;
Uint16 order18:1;
Uint16 order19:1;
Uint16 order20:1;
Uint16 order21:1;
Uint16 order22:1;
Uint16 order23:1;
Uint16 order24:1;
Uint16 order25:1;
Uint16 order26:1;
Uint16 order27:1;
Uint16 order28:1;
Uint16 order29:1;
Uint16 order30:1;
Uint16 order31:1;
};
union ORDER_REG{
Uint32 all;
struct ORDER_BIT bit;
};
/*****************************************************************************************************************************/
完毕 求大神解答,这个问题困惑我很久了。
mangui zhang:
跟踪一下TI 提供的 怎么定义的 怎么调用的