?
Solved

Need help with Compile err LNK2016

Posted on 2007-11-14
6
Medium Priority
?
398 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 1000 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 1000 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

801 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