Link to home
Start Free TrialLog in
Avatar of lapucca
lapucca

asked on

Need help with Compile err LNK2016

I have a C++ COM component built using only win32 lib.  I added a couple of
files from MMC help sample files to my projects and now I'm getting these
link error when I compile.  Can someone tell me how to correct this?  Thank
you.

Error      36      fatal error LNK1120: 3 unresolved externals      .\Debug/extProp.dll
Error      34      error LNK2019: unresolved external symbol "public: __thiscall
CDataObject::CDataObject(long,enum _DATA_OBJECT_TYPES)"
(??0CDataObject@@QAE@JW4_DATA_OBJECT_TYPES@@@Z) referenced in function
"public: virtual long __stdcall CComponentData::QueryDataObject(long,enum
_DATA_OBJECT_TYPES,struct IDataObject * *)"
(?QueryDataObject@CComponentData@@UAGJJW4_DATA_OBJECT_TYPES@@PAPAUIDataObject@@@Z)      CompData.obj
Error      33      error LNK2019: unresolved external symbol "public: __thiscall
CComponent::CComponent(class CComponentData *)"
(??0CComponent@@QAE@PAVCComponentData@@@Z) referenced in function "public:
virtual long __stdcall CComponentData::CreateComponent(struct IComponent *
*)" (?CreateComponent@CComponentData@@UAGJPAPAUIComponent@@@Z)      CompData.obj
Error      35      error LNK2019: unresolved external symbol "class CDataObject *
__cdecl GetOurDataObject(struct IDataObject *)"
(?GetOurDataObject@@YAPAVCDataObject@@PAUIDataObject@@@Z) referenced in
function "public: virtual long __stdcall
CComponentData::CompareObjects(struct IDataObject *,struct IDataObject *)"
(?CompareObjects@CComponentData@@UAGJPAUIDataObject@@0@Z)      CompData.obj

--
Thanks.
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Was it compiling before adding the new files?

Seems like the file which you have added have some dependent dll which you might have to include in your project settings. It is looking for some functions in the relying dll

Best Regards,
Deepu Abraham K



SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lapucca
lapucca

ASKER

I was missing dataobject.cpp.  Once I added that I am now down to one compiling error.  It seems to say that problem calling CComponentData::CreateComponent.  I have the CompData.cpp and .h file already in my project.  Why am I still getting this error?  Thank you.


Error      33      error LNK2019: unresolved external symbol "public: __thiscall CComponent::CComponent(class CComponentData *)" (??0CComponent@@QAE@PAVCComponentData@@@Z) referenced in function "public: virtual long __stdcall CComponentData::CreateComponent(struct IComponent * *)" (?CreateComponent@CComponentData@@UAGJPAPAUIComponent@@@Z)      CompData.obj
Any other file there that contains the constructor 'CComponent::CComponent'?
check the function CComponentData::CreateComponent in compdata.cpp

There must be a statement like

        pComponent = new CComponent(this);

If so, you have to add the constructor "CComponent::CComponent(CComponentData *)" to dataobject.h and dataobject.cpp, but don't ask me how to implement it. I don't know that sample and what is the purpose of these classes.