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?????这是什么错误啊?

解决方案 »

  1.   

    #include "TransferAccountThread所在的头文件"
      

  2.   

    MyThreadDlg是我的对话框类TransferAccountThread从CThread类派生的。
    我想启动一个多个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();
    };
      

  3.   

    // MyThreadDlg.h : header fileclass CMyThreadDlg : public CDialog
    {
    // 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中的值。好果我的方法不好,请高手指点一下,我应该怎么传?
      

  4.   

    在MyThreadDlg.h 文件的前面加下面一句看看:
    Class TransferAccountThread;//声明这一句,后面要用到的这个类。
      

  5.   

    应该加入#include "TransferAccountThread.h"就行了吧
      

  6.   

    光从错误信息来找错误(没有完整代码),真是难为大家了。谢谢。问题已经解决了。我在CMyThreadDlg中声明成员变量指针TransferAccountThread* lptq;
    而在TransferAccountThread类中又声明变量指针CMyThreadDlg* me;在创建时,就会进入重复了声明,所以发生错误。
    真是低级错误啊,基础功不扎实。