我现在看到模仿一个MFC类的那几页了,好像是70多页吧,就是MFC的类的运行,我按照代码写的,可编译时有错误,我看不懂, error C2460: 'theApp' : uses 'CMyWinApp', which is being defined
编译器说 正在用一个正被定义的,不知道什么意思,帮忙啊!

解决方案 »

  1.   

    在'theApp' 的定义中使用'CMyWinApp'
    Compiler Error C2460
    'identifier1' : uses 'identifier2', which is being definedThe given class or structure (identifier2) was declared as a member of itself (identifier1).Recursive definitions of classes and structures are not allowed.The following is an example of this error:class C
    {
       C aC;    // error
    };
      

  2.   

    class CWinApp:public CWinThread //CWinApp继承CWinThread
    {
    public:
    CWinApp *m_pCurrentWinApp;
    public:
    CWinApp::CWinApp(){
    cout<<"CWinApp Constructor!"<<endl;
    }
    CWinApp::~CWinApp(){
    cout<<"CWinApp Destructor!"<<endl;
    }
    };
    class CMyWinApp: public CWinApp
    {
    public:
    CMyWinApp::CMyWinApp(){
    cout<<"CMyWinApp Constructor"<<endl;
    }
    CMyWinApp::~CMyWinApp(){
    cout<<"CMyWinApp Destructor"<<endl;
    };
    这是这两个类的定义,不过我没有在类中定义变量啊,只是一个指针,不应该出问题啊,怎么改呢,
      

  3.   

    你的头文件被重复引用了。可以这样包裹一下你的头文件:
    #ifndef MY_MYNAME_WINAPP_HEADFILE
    #define MY_MYNAME_WINAPP_HEADFILE.......头文件原文#endif