[求助]processor expert标志位共用问题
- UID
- 145512
- 性别
- 男
|
[求助]processor expert标志位共用问题
各位大侠:
小弟用processor expert,定义的标志位(如:FG_LF_Moved)如何在两个文件中(如:main和event)共用?敬请大侠指教。
typedef union { unsigned char FlagByte; struct { unsigned char Flag0 :1; unsigned char Flag1 :1; unsigned char Flag2 :1; unsigned char Flag3 :1; unsigned char Flag4 :1; unsigned char Flag5 :1; unsigned char Flag6 :1; unsigned char Flag7 :1; } Bits; } Flag;
Flag GsFlag1;
#define FG_LF_Moved GsFlag1.Bits.Flag0 |
|
|
|
|
|
- UID
- 104380
- 性别
- 男
|
定义在一个头文件中,在需要的文件中include即可。或者用extern指示亦可。 |
|
|
|
|
|
- UID
- 145512
- 性别
- 男
|
用include会出现错误,提示包含冲突。用extern该怎么说明这种共用体类型呢? |
|
|
|
|
|
- UID
- 104380
- 性别
- 男
|
你可以参照CodeWarrior原有的头文件,采用#ifdefine/#endif的格式,就不会有包含冲突了。 |
|
|
|
|
|
- UID
- 145512
- 性别
- 男
|
|
|
|
|
|