Solved

Need help with Compile err LNK2016

Posted on 2007-11-14
6
393 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 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
Independent Software Vendors: 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C++ question 3 74
Precision Problem in C++ 7 48
Where are the c++ header files to use in Eclipse? 4 47
One named event, multiple event handlers 2 40
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

762 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