error C2143: syntax error : missing ';' before '*'
error C2501: 'TransferAccountThread' : missing storage-class or type specifiers
error C2501: 'lptq' : missing storage-class or type specifiers
Error executing cl.exe.TransferAccountThread.obj - 3 error(s), 0 warning(s)missing storage-class or type specifiers?????这是什么错误啊?
error C2501: 'TransferAccountThread' : missing storage-class or type specifiers
error C2501: 'lptq' : missing storage-class or type specifiers
Error executing cl.exe.TransferAccountThread.obj - 3 error(s), 0 warning(s)missing storage-class or type specifiers?????这是什么错误啊?
我想启动一个多个TransferAccountThread线程来对我的对话框类MyThreadDlg中的list进行值变化(就是把每次的交易数量记录到list中)所以在每个线程中交易完都会对list进行追加操作。
现在的问题就是
要传一个MyThreadDlg指针给类TransferAccountThread(LPVOID pParam,CCustom& custom);
但是,编译不通过,错误好上面,我不知道怎么回事。
syntax error : missing ';' before '*'// Thread.h
class CThread
{
public:
CThread();
CThread(int SleepTime); virtual ~CThread();
private:
int m_nSleepTime;
BOOL m_bRun;
CWinThread* m_pMyThread; void init(int SleepTime);
virtual void run();
public:
static UINT MyThreadProc( LPVOID pParam);
CWinThread* getThread();
void start();
void stop();
void terminate();
};// TransferAccountThread.h
class TransferAccountThread: public CThread{
private:
CMyThreadDlg* me;
public:
TransferAccountThread(); // standard constructor
TransferAccountThread(LPVOID pParam,CCustom& custom);
virtual ~TransferAccountThread();
void run();
};
{
// Construction
public:
CMyThreadDlg(CWnd* pParent = NULL); // standard constructor
...
CCriticalSection ccs;
CWinThread* pMyThread;
void transfer(int from,int to ,int amount);
TransferAccountThread* lptq;//这里会出现报错
CCustom* lpcus;
};// MyThreadDlg.cpp
CMyThreadDlg::CMyThreadDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMyThreadDlg::IDD, pParent)
{
...
this->lpcus =NULL;
this->lptq =NULL;
}void CMyThreadDlg::OnButtonstart()
{
// TODO: Add your control notification handler code here
if(this->m_bRun){//run now
GetDlgItem(IDC_BUTTONSTART)->SetWindowText("start");
if (this->pMyThread){
this->lptq->terminate();
delete this->lptq;
delete this->lpcus;
}
}
else{//not run now
GetDlgItem(IDC_BUTTONSTART)->SetWindowText("stop");
this->lpcus=new CCustom("aaa");
this->lptq=new TransferAccountThread(this,*this->lpcus);
}
this->m_bRun=!this->m_bRun;
}
我主要是想把CMyThreadDlg对话框类传给线程,让线程来这断更新CEdit中的值。好果我的方法不好,请高手指点一下,我应该怎么传?
Class TransferAccountThread;//声明这一句,后面要用到的这个类。
而在TransferAccountThread类中又声明变量指针CMyThreadDlg* me;在创建时,就会进入重复了声明,所以发生错误。
真是低级错误啊,基础功不扎实。