Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. IMPLEMENT_DYNAMIC Error

IMPLEMENT_DYNAMIC Error

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Guoguor
    wrote on last edited by
    #1

    Code : at .cpp file : IMPLEMENT_DYNAMIC(alb2CaptureOptionTree , COptionTree) //two .h file class COptionTree : public CWnd { .................... } class alb2CaptureOptionTree : public COptionTree { DECLARE_DYNAMIC(alb2CaptureOptionTree) .......... } Error : when compiling the code , Errors occur . error C2039: 'classCOptionTree' : is not a member of 'COptionTree' error C2065: 'classCOptionTree' : undeclared identifier In fact , I never define a class named classCOptionTree. Why ? What's the reason? Thank you ! Fly as a bird

    N 1 Reply Last reply
    0
    • G Guoguor

      Code : at .cpp file : IMPLEMENT_DYNAMIC(alb2CaptureOptionTree , COptionTree) //two .h file class COptionTree : public CWnd { .................... } class alb2CaptureOptionTree : public COptionTree { DECLARE_DYNAMIC(alb2CaptureOptionTree) .......... } Error : when compiling the code , Errors occur . error C2039: 'classCOptionTree' : is not a member of 'COptionTree' error C2065: 'classCOptionTree' : undeclared identifier In fact , I never define a class named classCOptionTree. Why ? What's the reason? Thank you ! Fly as a bird

      N Offline
      N Offline
      narendra_ b
      wrote on last edited by
      #2

      add DECLARE_DYNAMIC in base class also. In ur code add DECLARE_DYNAMIC(COptionTree) in class COptionTree, and add IMPLEMENT_DYNAMIC(COptionTree,CWnd)in the cpp file Naren VC++ programmer

      G 1 Reply Last reply
      0
      • N narendra_ b

        add DECLARE_DYNAMIC in base class also. In ur code add DECLARE_DYNAMIC(COptionTree) in class COptionTree, and add IMPLEMENT_DYNAMIC(COptionTree,CWnd)in the cpp file Naren VC++ programmer

        G Offline
        G Offline
        Guoguor
        wrote on last edited by
        #3

        Thanks ! It's right ! But Why?

        G N B 3 Replies Last reply
        0
        • G Guoguor

          Thanks ! It's right ! But Why?

          G Offline
          G Offline
          Guoguor
          wrote on last edited by
          #4

          When Link Errors occur again ! Do you know why ? alb2CaptureProxyPluginPage.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE StdAfx.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE OptionTree.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE alb2CaptureOptionTree.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE alb2CaptureProxyPlugin.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE alb2CaptureProxyPluginDll.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE alb2CaptureProxyPluginIFace.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE alb2CaptureOptionTree.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CWnd::SetOccDialogInfo(struct _AFX_OCC_DIALOG_INFO *)" (?SetOccDialogInfo@CWnd@@MAEHPAU_AFX_OCC_DIALOG_INFO@@@Z) OptionTree.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CWnd::SetOccDialogInfo(struct _AFX_OCC_DIALOG_INFO *)" (?SetOccDialogInfo@CWnd@@MAEHPAU_AFX_OCC_DIALOG_INFO@@@Z) alb2CaptureOptionTree.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWnd::IsFrameWnd(void)const " (?IsFrameWnd@CWnd@@UBEHXZ) OptionTree.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWnd::IsFrameWnd(void)const " (?IsFrameWnd@CWnd@@UBEHXZ) alb2CaptureOptionTree.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWnd::CheckAutoCenter(void)" (?CheckAutoCenter@CWnd@@UAEHXZ) OptionTree.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWnd::CheckAutoCenter(void)" (?CheckAutoCenter@CWnd@@UAEHXZ) alb2CaptureOptionTree.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CWnd::OnChildNotify(unsigned int,unsigned int,long,long *)" (?OnChildNotify@CWnd@@MAEHIIJPAJ@Z) OptionTree.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall

          N 1 Reply Last reply
          0
          • G Guoguor

            Thanks ! It's right ! But Why?

            N Offline
            N Offline
            narendra_ b
            wrote on last edited by
            #5

            check with the definition of IMPLEMENT_DYNAMIC. ultimately it will call the CRuntimeClass(base_class). Thats why u need to implement dynamic creattion inevery class in up heirarchy naren VC++ programmer

            1 Reply Last reply
            0
            • G Guoguor

              When Link Errors occur again ! Do you know why ? alb2CaptureProxyPluginPage.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE StdAfx.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE OptionTree.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE alb2CaptureOptionTree.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE alb2CaptureProxyPlugin.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE alb2CaptureProxyPluginDll.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE alb2CaptureProxyPluginIFace.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE alb2CaptureOptionTree.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CWnd::SetOccDialogInfo(struct _AFX_OCC_DIALOG_INFO *)" (?SetOccDialogInfo@CWnd@@MAEHPAU_AFX_OCC_DIALOG_INFO@@@Z) OptionTree.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CWnd::SetOccDialogInfo(struct _AFX_OCC_DIALOG_INFO *)" (?SetOccDialogInfo@CWnd@@MAEHPAU_AFX_OCC_DIALOG_INFO@@@Z) alb2CaptureOptionTree.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWnd::IsFrameWnd(void)const " (?IsFrameWnd@CWnd@@UBEHXZ) OptionTree.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWnd::IsFrameWnd(void)const " (?IsFrameWnd@CWnd@@UBEHXZ) alb2CaptureOptionTree.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWnd::CheckAutoCenter(void)" (?CheckAutoCenter@CWnd@@UAEHXZ) OptionTree.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWnd::CheckAutoCenter(void)" (?CheckAutoCenter@CWnd@@UAEHXZ) alb2CaptureOptionTree.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CWnd::OnChildNotify(unsigned int,unsigned int,long,long *)" (?OnChildNotify@CWnd@@MAEHIIJPAJ@Z) OptionTree.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall

              N Offline
              N Offline
              narendra_ b
              wrote on last edited by
              #6

              try by setting the correct lib paths. Is it linking successfully if u omit the DECLARE_DYNAMIC, IMPLEMENT_DYNAMIC?? naren VC++ programmer

              G 1 Reply Last reply
              0
              • G Guoguor

                Thanks ! It's right ! But Why?

                B Offline
                B Offline
                Bob Stanneveld
                wrote on last edited by
                #7

                Hello, The DELCARE_SomeThing {SERIAL, DYNAMIC and DYNCREATE} macros are used to implement some features provided by CObject. Some of these features are RTTI provided by MFC, serialization and dynamic creation using the RUNTIME_CLASS macro. If your class wants to use one or more of these features, it should be derived from a class that has these features. If you don't you'll get those errors you had. Read here[^] for more information about CObject and dynamic object support. Behind every great black man...             ... is the police. - Conspiracy brother Blog[^]

                1 Reply Last reply
                0
                • N narendra_ b

                  try by setting the correct lib paths. Is it linking successfully if u omit the DECLARE_DYNAMIC, IMPLEMENT_DYNAMIC?? naren VC++ programmer

                  G Offline
                  G Offline
                  Guoguor
                  wrote on last edited by
                  #8

                  What lib paths do I need ? I don't know. can you tell me ?

                  N 1 Reply Last reply
                  0
                  • G Guoguor

                    What lib paths do I need ? I don't know. can you tell me ?

                    N Offline
                    N Offline
                    narendra_ b
                    wrote on last edited by
                    #9

                    is it linking successfully without DECLARE_DYNAMIC, IMPLEMENT_DYNAMIC naren VC++ programmer

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups