Recently, When I was engaged in camera on mobile, I encountered a strange Link error. I will record it here.
Step 1
The simplest error. This error is similar to the following error messsage:
1> cameraempty. OBJ: Error lnk2001: unresolved external symbol iid_ivideowindow
1> cameraempty. OBJ: Error lnk2001: unresolved external symbol pin_category_preview
1> cameraempty. OBJ: Error lnk2001: unresolved external symbol mediatype_video
1> cameraempty. OBJ: Error lnk2001: unresolved external symbol clsid_videocapture
1> cameraempty. OBJ: Error lnk2001: unresolved external symbol clsid_filtergraph
1> cameraempty. OBJ: Error lnk2001: unresolved external symbol clsid_capturegraphbuilder
The reason for this style error is that you did not introduce those lib commonly used by DirectX. The solution is to add this code in stdafx. h:
# Pragma comment (Lib, "atlosapis. lib ") <br/> # pragma comment (Lib," strmbase. lib ") <br/> # pragma comment (Lib," strmiids. lib ") <br/> # pragma comment (Lib," dmoguids. lib ") <br/>
Step 2
Many times these databases are introduced with other connection errors, such:
1> cameraempty. OBJ: Error lnk2019: unresolved external symbol "public: _ cdecl ctransinplacefilter: ctransinplacefilter (wchar_t *, struct iunknown *, struct _ guid const &, long *)"(?? 0ctransinplacefilter @ Qaa @ alias @ abu_guid @ paj @ Z) referenced in function "public: _ cdecl crotatefilter: crotatefilter (wchar_t *, struct iunknown *, long *) "(?? 0crotatefilter @ Qaa @ pa_wpauiunknown @ paj @ Z)
1> cameraempty. OBJ: Error lnk2001: unresolved external symbol "public: Virtual long _ cdecl ctransformfilter: findpin (wchar_t const *, struct ipin **)"(? Findpin @ ctransformfilter @ uaajpb_wpapauipin @ Z)
1> cameraempty. OBJ: Error lnk2001: unresolved external symbol "public: Virtual long _ cdecl cbasefilter: joinfiltergraph (struct ifiltergraph *, wchar_t const *)"(? Joinfiltergraph @ cbasefilter @ uaajpauifiltergraph @ pb_w @ Z)
1> cameraempty. OBJ: Error lnk2001: unresolved external symbol "public: Virtual long _ cdecl cbasefilter: queryvendorinfo (wchar_t **)"(? Queryvendorinfo @ cbasefilter @ uaajpapa_w @ Z)
Such a link error comes from a setting in the project:
Configuration properties => C/C ++ => Language
Set the value of treat wchar_t as built-in type to no! This type of problem is roughly solved. Most of the time, this step can be compiled. Of course, I mean release build can already be compiled, but there is still a problem during the compilation of the debug version. This is the third step.
Step 3.
Cameraempty. OBJ: Error lnk2001: unresolved external symbol "public: Virtual unsigned long _ cdecl cbasefilter: nondelegatingrelease (void )"(? Nondelegatingrelease @ cbasefilter @ uaakxz)
This is a classic problem because the strmbase lib released with the SDK is incorrect in debug mode and should be replaced by a new strmbase. lib and strmbase. PDB package. For ppc sdk, this location is
C:/program files/Windows CE tools/wce500/Windows Mobile 5.0 Pocket pc sdk/lib/armv4i
The location of the new package can be downloaded at http://www.alexfeinman.com/files/strmbase.zip.
Of course, if you do not need to replace this package, you can compile the release version. The release version always works. Alternatively, you can implement the nondelegatingrelease method of a base class by yourself.
This is still a tough task. I hope other people will not be bored.