简体   繁体   中英

Resolving unresolved external symbol CSourceSeeking::CSourceSeeking(…) despite linking with the right library

Here is the error:

Error 2 error LNK2019: unresolved external symbol "protected: __thiscall CSourceSeeking::CSourceSeeking(char const *,struct IUnknown *,long *,class CCritSec *)" (??
0CSourceSeeking@@IAE@PBDPAUIUnknown@@PAJPAVCCritSec@@@Z) referenced in function "public: __thiscall CPushPin::CPushPin(long *,class CSource *)" (??0CPushPin@@QAE@PAJPAVCSource@@@Z) C:\\Users\\x\\Desktop\\PushSource\\PushFilter.obj > PushSource

Here are my libs:

gdiplus.lib strmbasd.lib msvcrtd.lib winmm.lib odbc32.lib odbccp32.lib

What lib is CSourceSeeking in?

You have to create Strmbase.lib / Strmbased.lib yourself, apparently. Make sure it's built for your target (ie if your program is 32-bit, make sure it's built as a 32-bit library; same for 64-bit).

At the bottom of most C/C++ API Reference pages on MSDN you will find a References section telling you what headers to include and what libraries to link with.

Correspondingly, in the References section of the CSourceSeeking reference page you shall find your answer:

Strmbase.lib (retail builds)
Strmbasd.lib (debug builds)

EDIT

See @Cornstalk's answer for instructions on how to build Strmbase.lib / Strmbased.lib yourself. When you build Strmbase.lib / Strmbased.lib , make sure the library build settings match your program's build settings: 32/64 bit, UNICODE / ANSI , etc. Using different settings for one or the other will cause errors.

CSourceSeeking class is part of the Strmbase.lib library (or Strmbasd.lib for debug builds). Generally, MSDN states header file(s) and library(ies) requirements under "Requirements" section of a corresponding documentation page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM