Using vector as class member lead to Data Abort error
Hi, I'm coding on windows mobile 6 and I have meet a strange problem,
which I have already tried to Google it, but still cann't work it out.
here is my problem:
there is a class with a vector as member as below:
code:
/**********MyTest.h****************/
#pragma once
#include <string>
#include <vector>
class CMyTest
{
public:
CMyTest(void);
public:
~CMyTest(void);
private:
vector<string> m_vecString;
};
/*****************************/
and I also have a dialog class as below,which has CMyTest class
object:
/**************Mobile_Test**************/
// Mobile_TestDlg.h
#pragma once
#include <iostream>
#include <fstream>
#include "InfoDlg.h"
#include "MyTest.h"
#define WM_MSGWHITSTR (WM_USER+193)
class CMobile_TestDlg : public CDialog
{
public:
CMobile_TestDlg(CWnd* pParent = NULL);
enum { IDD = IDD_MOBILE_TEST_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
protected:
HICON m_hIcon;
virtual BOOL OnInitDialog();
#if defined(_DEVICE_RESOLUTION_AWARE) && !defined
(WIN32_PLATFORM_WFSP)
afx_msg void OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/);
#endif
DECLARE_MESSAGE_MAP()
/*================Data====================*/
public:
BYTE m_sharedDataArray[521];
private:
CMyTest m_test; //!!!!
public:
static UINT Reader(LPVOID pParam);
static UINT Writer(LPVOID pParam);
public:
afx_msg void OnBnClickedButtonOk();
LRESULT OnMsgwithStr(WPARAM wParam, LPARAM lParam);
public:
afx_msg void OnBnClickedButtonTest();
};
/****************************/
this program compiled fine, but when I run it on Debug mode, I get
error as below:
Platform Type : PocketPC
Data Abort: Thread=97b0aa40 Proc=8c3e89e0 'Mobile_Test.exe'
AKY=00400001 PC=00018c38(Mobile_Test.exe+0x00008c38) RA=0001981c
(Mobile_Test.exe+0x0000981c) BVA=2e29f8f9 FSR=00000001
Unhandled exception at 0x00018c38 in Mobile_Test.exe: 0x80000002:
Datatype misalignment.
and this error seems to happen in the constructor of CTest. because
when I run it step by step, it turns out the error is happened at :
/************xutility.h*******************/
__CLR_OR_THIS_CALL _Container_base()
: _Myfirstiter(0)
{ // construct childless container
}
/****************************/
I have no idea why this error happened, Any assistance would be
appreciated.
Thx