太诡异了,头文件里定义CString类型变量居然要按顺序!解决思路

太诡异了,头文件里定义CString类型变量居然要按顺序!!
public:
unsigned char strToInt(CString strNum);
void OnSend(int num,unsigned char *des);
CString strCommPort;//?????????????????????????????????
long GetBaud();
long m_baud;

CMifareDlg(CWnd* pParent = NULL); // standard constructor

protected:
int OnBCCCheck(int ,unsigned char *);
unsigned char *ExaInputData();
BOOL m_PortStatus;
void OnCommMscomm1();
HICON m_hIcon;
CString m_strPortSetting; //port状态用//???????????????????????????????????????
CString m_strCommSetting; //通信状态//?????????


在VC++ 6.0环境下,写了一个程序。过程中遇到一个BUG,几天下来都未能解决。今天和原来运行正常的这个代码初期时候想比较发现,原因是在标注为“?????”的地方。只要把定义的变量顺序改变一下,比如把CString strCommPort和其它变量如long m_baud换一下位置,在运行结束的时候就会报:
unhandled exception in kernel32.dll:0x00000005 Access violation

Microsoft Visual C++ Debug Library
File:afx.inl
Line:122

如果要换:
CString m_strPortSetting; //port状态用//???????????????????????????????????????
CString m_strCommSetting; //通信状态//?????????
结果还是出错。
跟踪发现,在程序关闭时候,运行到下面的函数里
CString::~CString()
// free any attached data
{
if (GetData() != _afxDataNil)
{
if (InterlockedDecrement(&GetData()->nRefs) <= 0)//?????
FreeData(GetData());
}
}

在运行到标注的地方就会弹出错误提示。让你“Abort”"Retry","Ignore".
难道定义CString 变量时候要按顺序定义????迷惑中。。。。。

------解决方案--------------------
.......貌似上周我也遇到这个问题 也是定义字符串时出错 当时我也怀疑是str范围超出了

后来就变成只要一在头文件里定义变量就会报错....

试一试Rebuild All

第二天,电脑重启,我把文件夹复制粘贴重命名后,就好了。
很奇怪。