Solved

Need help with Compile err LNK2016

Posted on 2007-11-14
6
382 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:lapucca
Comment Utility
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
Comment Utility
Any other file there that contains the constructor 'CComponent::CComponent'?
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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. …
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 goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now