error LNK2001
-
Hi, I've created an ActiveX control. The Control class (***Ctl) in it should be derived from a class in another dll (which is also created by me). I want to load the ActiveX control dynamically in a container exe and check if the Ctl class is derived from the base class in the dll (This container is also created by me). The base class in the dll is called TusMacroOcxBase and it is derived from COleControl. The Ctl class in the ActiveX control which is derived from TusMacroOcxBase is called CTusSampleOcxCtrl. I decided to make use of CRuntime class's methods to check the class type information (Since COleControl is already derived from CObject). So I proceeded by using the DECLARE_DYNAMIC/DECLARE_DYNCREATE and IMPLEMENT_DYNAMIC/IMPLEMENT_DYNCREATE macros. I also enabled RTTI in the container exe. My problem is that when I write IMPLEMENT_DYNCREATE(CTusSampleOcxCtrl, TusMacroOcxBase) in CTusSampleOcxCtrl class's .cpp file, it gives error LNK2001. The error message is given below. TusSampleOcxCtl.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const TusMacroOcxBase::classTusMacroOcxBase" (?classTusMacroOcxBase@TusMacroOcxBase@@2UCRuntimeClass@@B) Here is the code snippet: Base class - .h class _declspec(dllexport) TusMacroOcxBase : public COleControl { public: DECLARE_DYNAMIC(TusMacroOcxBase) .... Base class - .cpp IMPLEMENT_DYNAMIC( TusMacroOcxBase, COleControl ) Derived class - .h class CTusSampleOcxCtrl : public TusMacroOcxBase { DECLARE_DYNCREATE(CTusSampleOcxCtrl) .... Derived class - .cpp IMPLEMENT_DYNCREATE(CTusSampleOcxCtrl, TusMacroOcxBase) I can solve the error easily by replacing IMPLEMENT_DYNCREATE(CTusSampleOcxCtrl, TusMacroOcxBase) with IMPLEMENT_DYNCREATE(CTusSampleOcxCtrl, COleControl), but I cant do that since I need to get the exact base class of CTusSampleOcxCtrl in the container exe. If I give COleControl there, I will get the base class as COleControl only. Is there any other way? I've tried different combinations of DECLARE_DYNAMIC/DECLARE_DYNCREATE and IMPLEMENT_DYNAMIC/IMPLEMENT_DYNCREATE also. Any help will be greatly appreciated. Thanks in advance, Rems.
-
Hi, I've created an ActiveX control. The Control class (***Ctl) in it should be derived from a class in another dll (which is also created by me). I want to load the ActiveX control dynamically in a container exe and check if the Ctl class is derived from the base class in the dll (This container is also created by me). The base class in the dll is called TusMacroOcxBase and it is derived from COleControl. The Ctl class in the ActiveX control which is derived from TusMacroOcxBase is called CTusSampleOcxCtrl. I decided to make use of CRuntime class's methods to check the class type information (Since COleControl is already derived from CObject). So I proceeded by using the DECLARE_DYNAMIC/DECLARE_DYNCREATE and IMPLEMENT_DYNAMIC/IMPLEMENT_DYNCREATE macros. I also enabled RTTI in the container exe. My problem is that when I write IMPLEMENT_DYNCREATE(CTusSampleOcxCtrl, TusMacroOcxBase) in CTusSampleOcxCtrl class's .cpp file, it gives error LNK2001. The error message is given below. TusSampleOcxCtl.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const TusMacroOcxBase::classTusMacroOcxBase" (?classTusMacroOcxBase@TusMacroOcxBase@@2UCRuntimeClass@@B) Here is the code snippet: Base class - .h class _declspec(dllexport) TusMacroOcxBase : public COleControl { public: DECLARE_DYNAMIC(TusMacroOcxBase) .... Base class - .cpp IMPLEMENT_DYNAMIC( TusMacroOcxBase, COleControl ) Derived class - .h class CTusSampleOcxCtrl : public TusMacroOcxBase { DECLARE_DYNCREATE(CTusSampleOcxCtrl) .... Derived class - .cpp IMPLEMENT_DYNCREATE(CTusSampleOcxCtrl, TusMacroOcxBase) I can solve the error easily by replacing IMPLEMENT_DYNCREATE(CTusSampleOcxCtrl, TusMacroOcxBase) with IMPLEMENT_DYNCREATE(CTusSampleOcxCtrl, COleControl), but I cant do that since I need to get the exact base class of CTusSampleOcxCtrl in the container exe. If I give COleControl there, I will get the base class as COleControl only. Is there any other way? I've tried different combinations of DECLARE_DYNAMIC/DECLARE_DYNCREATE and IMPLEMENT_DYNAMIC/IMPLEMENT_DYNCREATE also. Any help will be greatly appreciated. Thanks in advance, Rems.
-
Please check whether you hav added lib path Project|Properties|Linker|Input|Addition al Dependencies. Rinu Raj
-
is that lib available in path ? if not please add the path what about the header file associated is that compatible with the lib ? Rinu Raj