Solved

Subject: Link error during object creation

Posted on 2007-03-21
4
758 Views
Last Modified: 2013-12-08
I'm writing a directshow filter by extending CTransInPlaceFilter class. My
platform is Windows Mobile 6.0

my class constructor is as follows
CFPSFilter(TCHAR* tszName, LPUNKNOWN pUnk, HRESULT *phr) :
    CTransInPlaceFilter(tszName, pUnk, CLSID_CFPSFilter, phr)
{}

everything goes fine until i instantiate the class using this call inside
CreateInstance function
CFPSFilter *pFilter = new CFPSFilter(NAME("FPS Counter"), pUnk, pHr);

then build it, generates the following catastrophic errors

1>------ Build started: Project: CFPSFilter, Configuration: Debug Windows
Mobile 6 Professional SDK (ARMV4I) ------
1>Compiling...
1>CFPSFilter.cpp
1>Linking...
1>   Creating library Windows Mobile 6 Professional SDK
(ARMV4I)\Debug/CFPSFilter.lib and object Windows Mobile 6 Professional SDK
(ARMV4I)\Debug/CFPSFilter.exp
1>CFPSFilter.obj : error LNK2019: unresolved external symbol "public:
__cdecl CTransInPlaceFilter::CTransInPlaceFilter(wchar_t *,struct IUnknown
*,struct _GUID const &,long *)"
(??0CTransInPlaceFilter@@QAA@PA_WPAUIUnknown@@ABU_GUID@@PAJ@Z) referenced in
function "public: __cdecl CFPSFilter::CFPSFilter(wchar_t *,struct IUnknown
*,long *)" (??0CFPSFilter@@QAA@PA_WPAUIUnknown@@PAJ@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::NonDelegatingQueryInterface(struct _GUID
const &,void * *)"
(?NonDelegatingQueryInterface@CBaseFilter@@UAAJABU_GUID@@PAPAX@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual unsigned long __cdecl CUnknown::NonDelegatingAddRef(void)"
(?NonDelegatingAddRef@CUnknown@@UAAKXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual unsigned long __cdecl CBaseFilter::NonDelegatingRelease(void)"
(?NonDelegatingRelease@CBaseFilter@@UAAKXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::StreamTime(class CRefTime &)"
(?StreamTime@CBaseFilter@@UAAJAAVCRefTime@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::GetPinVersion(void)"
(?GetPinVersion@CBaseFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual int __cdecl CTransformFilter::GetPinCount(void)"
(?GetPinCount@CTransformFilter@@UAAHXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual class CBasePin * __cdecl CTransInPlaceFilter::GetPin(int)"
(?GetPin@CTransInPlaceFilter@@UAAPAVCBasePin@@H@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::Transform(struct IMediaSample *,struct
IMediaSample *)" (?Transform@CTransformFilter@@UAAJPAUIMediaSample@@0@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransInPlaceFilter::DecideBufferSize(struct
IMemAllocator *,struct _AllocatorProperties *)"
(?DecideBufferSize@CTransInPlaceFilter@@UAAJPAUIMemAllocator@@PAU_AllocatorProperties@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::StartStreaming(void)"
(?StartStreaming@CTransformFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::StopStreaming(void)"
(?StopStreaming@CTransformFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::AlterQuality(struct tagQuality)"
(?AlterQuality@CTransformFilter@@UAAJUtagQuality@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::SetMediaType(enum _PinDirection,class
CMediaType const *)"
(?SetMediaType@CTransformFilter@@UAAJW4_PinDirection@@PBVCMediaType@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::CheckConnect(enum _PinDirection,struct
IPin *)" (?CheckConnect@CTransformFilter@@UAAJW4_PinDirection@@PAUIPin@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::BreakConnect(enum _PinDirection)"
(?BreakConnect@CTransformFilter@@UAAJW4_PinDirection@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransInPlaceFilter::CompleteConnect(enum
_PinDirection,struct IPin *)"
(?CompleteConnect@CTransInPlaceFilter@@UAAJW4_PinDirection@@PAUIPin@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransInPlaceFilter::Receive(struct IMediaSample *)"
(?Receive@CTransInPlaceFilter@@UAAJPAUIMediaSample@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::EndOfStream(void)"
(?EndOfStream@CTransformFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::BeginFlush(void)"
(?BeginFlush@CTransformFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::EndFlush(void)"
(?EndFlush@CTransformFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::NewSegment(__int64,__int64,double)"
(?NewSegment@CTransformFilter@@UAAJ_J0N@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CFPSFilter::Transform(struct IMediaSample *)"
(?Transform@CFPSFilter@@UAAJPAUIMediaSample@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::GetClassID(struct _GUID *)"
(?GetClassID@CBaseFilter@@UAAJPAU_GUID@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::Stop(void)"
(?Stop@CTransformFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::Pause(void)"
(?Pause@CTransformFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::Run(__int64)" (?Run@CBaseFilter@@UAAJ_J@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::GetState(unsigned long,enum _FilterState
*)" (?GetState@CBaseFilter@@UAAJKPAW4_FilterState@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::SetSyncSource(struct IReferenceClock *)"
(?SetSyncSource@CBaseFilter@@UAAJPAUIReferenceClock@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::GetSyncSource(struct IReferenceClock * *)"
(?GetSyncSource@CBaseFilter@@UAAJPAPAUIReferenceClock@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::EnumPins(struct IEnumPins * *)"
(?EnumPins@CBaseFilter@@UAAJPAPAUIEnumPins@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::FindPin(wchar_t const *,struct IPin *
*)" (?FindPin@CTransformFilter@@UAAJPB_WPAPAUIPin@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::QueryFilterInfo(struct _FilterInfo *)"
(?QueryFilterInfo@CBaseFilter@@UAAJPAU_FilterInfo@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::JoinFilterGraph(struct IFilterGraph
*,wchar_t const *)"
(?JoinFilterGraph@CBaseFilter@@UAAJPAUIFilterGraph@@PB_W@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::QueryVendorInfo(wchar_t * *)"
(?QueryVendorInfo@CBaseFilter@@UAAJPAPA_W@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::Register(void)"
(?Register@CBaseFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::Unregister(void)"
(?Unregister@CBaseFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2019: unresolved external symbol "void __cdecl
DbgBreakPoint(wchar_t const *,wchar_t const *,int)"
(?DbgBreakPoint@@YAXPB_W0H@Z) referenced in function "public: virtual long
__cdecl CTransInPlaceFilter::GetMediaType(int,class CMediaType *)"
(?GetMediaType@CTransInPlaceFilter@@UAAJHPAVCMediaType@@@Z)
1>CFPSFilter.obj : error LNK2019: unresolved external symbol "public:
virtual __cdecl CTransformFilter::~CTransformFilter(void)"
(??1CTransformFilter@@UAA@XZ) referenced in function "public: virtual __cdecl
CTransInPlaceFilter::~CTransInPlaceFilter(void)"
(??1CTransInPlaceFilter@@UAA@XZ)
1>Windows Mobile 6 Professional SDK (ARMV4I)\Debug/CFPSFilter.dll : fatal
error LNK1120: 39 unresolved externals
1>Build log was saved at "file://d:\CFPSFilter\CFPSFilter\Windows Mobile 6
Professional SDK (ARMV4I)\Debug\BuildLog.htm"
1>CFPSFilter - 40 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

is there any reason why i am getting all these errors?
thanks!
0
Comment
Question by:fungi8210
4 Comments
 
LVL 24

Accepted Solution

by:
fridom earned 500 total points
ID: 18769361
Yes, you do not have included the needed libraries
_cdecl CTransInPlaceFilter::CTransInPlaceFilter(wchar_t *,struct IUnknown
*,struct _GUID const &,long *)"
What header is it declared in and to what library, is needed.

Or on the other hand if you have written the code yourself you must include it into the project.

Regards
Friedrich
0
 

Author Comment

by:fungi8210
ID: 18769376
hi, i just included the necessary libraries, and it solved the problem.
But the needed library to link was told by someone else, my problem is how do i know what library to link to since the error message does not give any indications.
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 18769570
>>>> my problem is how do i know what library to link
It is not so difficult. All standard libraries came with the compiler. 99% of these are in sub-directories called 'lib'. These paths automatically were searched when building a project. If you added own libraries you need to add the library paths to the export lib to the current linker settings. In Visual Studio it is in the Linker Settings - Additional Library Paths. There are also common library paths settings - if you need a path for more than one project - in Tools - Options - Directories - Library Directories. For makefiles or command line builds you may expand the environment variable LIB. If you added a third party product you also have to spot the lib subdirectory that comes with that product and add the include and lib paths accordingly. For dlls you need to expand the PATH environment variable.

If you get linker errors regarding unresolved externals you need to find out to what product the missing modules belong to. That normally isn't difficult cause you must have used these modules somehow from your code or the linker wouldn't complain. With the product name you go the docs and references and search for the missing module names. There you should find what library they belong to and can add the library to your linker settings.

Regards, Alex
0
 
LVL 12

Expert Comment

by:trinitrotoluene
ID: 18769783
>>>>>>how do i know what library to link to since the error message does not give any indications

this is the minimum that you should know as a developer of your application. Usually documentation is provided in any SDK about which libraries to use and their corresponding header files. At the minimum you should atleast go through these header files atleast to see the class hierarchies, methods provided etc...
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
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.

778 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