Solved

Need help with Compile err LNK2016

Posted on 2007-11-14
6
391 Views
Last Modified: 2012-06-22
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.
0
Comment
Question by:lapucca
6 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 20284617
Well, you will need to add the files from the sample that cointain the code from the error message also. Search the files for "CComponent::CComponent", "CComponentData::CompareObjects" and "CDataObject::CDataObject" and add the files where they are found to your project.
0
 
LVL 11

Expert Comment

by:DeepuAbrahamK
ID: 20284641
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



0
 
LVL 39

Assisted Solution

by:itsmeandnobodyelse
itsmeandnobodyelse earned 250 total points
ID: 20287963
The files 'dataobj.cpp' and 'compdata.cpp' should contain the missing functions. If yes, you need to add these cpp files to your project. If not, check the headers 'dataobj.h' and 'compdata.h' whether they have defined these functions.

Regards, Alex
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:lapucca
ID: 20290239
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
0
 
LVL 86

Expert Comment

by:jkr
ID: 20290292
Any other file there that contains the constructor 'CComponent::CComponent'?
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 20290540
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.

     
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Fast, free, private online code repository / editor 7 106
IdTelnet1DataAvailable handler freezes the Application 4 84
max float value 3 51
Need some help with mailto 16 20
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question