在 Windows 10 上构建 Vivek 的虚拟相机时出现链接器错误?

问题描述

我正在尝试在 Windows 10 上构建 Vivek's Virtual Camera
为此,我需要 Win7Samples/multimedia/directshow/baseclasses

我已下载 baseclasses 并使用 Visual Studio 2019 构建它。
现在我准备构建虚拟相机过滤器。我遵循了一些必要的步骤

  1. git clone https://github.com/roman380/tmhare.mvps.org-vcam
  2. cd tmhare.mvps.org-vcam\Filters
  3. 然后我尝试在 Visual Studio 2019 中打开 Filters.dsp,它要求我执行 one-way upgrade

    enter image description here

  4. C:\Users\alokm\tmp\Windows-classic-samples\Samples\Win7Samples\multimedia\directshow\baseclasses
    添加Additional Include Directories

    enter image description here

  5. C:\Users\alokm\tmp\Windows-classic-samples\Samples\Win7Samples\multimedia\directshow\baseclasses\Debug 添加Addition Library Directories

    enter image description here

  6. 完成所有这些步骤后,我尝试通过点击 Build >> Build Solution
    但是我收到了很多链接错误

    enter image description here

文本格式错误

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2001 unresolved external symbol _memcmp  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(combase.obj)   1   
Error   LNK2001 unresolved external symbol _memcmp  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(mtype.obj) 1   
Error   LNK2001 unresolved external symbol _memcmp  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(amfilter.obj)  1   
Error   LNK2001 unresolved external symbol _memcmp  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\Filters.obj 1   
Error   LNK2001 unresolved external symbol _memcmp  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(dllentry.obj)  1   
Error   LNK2001 unresolved external symbol _memcmp  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(wxdebug.obj)   1   
Error   LNK2001 unresolved external symbol _memcmp  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(amvideo.obj)   1   
Error   LNK2019 unresolved external symbol _memset referenced in function "public: virtual long __thiscall CVCamStream::GetMediaType(int,class cmediaType *)" (?GetMediaType@CVCamStream@@UAEJHPAVcmediaType@@@Z)   Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\Filters.obj 1   
Error   LNK2001 unresolved external symbol _memset  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(wxdebug.obj)   1   
Error   LNK2001 unresolved external symbol _memset  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(mtype.obj) 1   
Error   LNK2001 unresolved external symbol _memset  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(amfilter.obj)  1   
Error   LNK2019 unresolved external symbol __imp__rand referenced in function "public: virtual long __thiscall CVCamStream::FillBuffer(struct IMediaSample *)" (?FillBuffer@CVCamStream@@UAEJPAUIMediaSample@@@Z)   Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\Filters.obj 1   
Error   LNK2001 unresolved external symbol ___CxxFrameHandler3  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(mtype.obj) 1   
Error   LNK2001 unresolved external symbol ___CxxFrameHandler3  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(amfilter.obj)  1   
Error   LNK2001 unresolved external symbol ___CxxFrameHandler3  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(source.obj)    1   
Error   LNK2001 unresolved external symbol ___CxxFrameHandler3  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(wxlist.obj)    1   
Error   LNK2001 unresolved external symbol ___CxxFrameHandler3  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\Filters.obj 1   
Error   LNK2001 unresolved external symbol ___CxxFrameHandler3  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(wxdebug.obj)   1   
Error   LNK2001 unresolved external symbol ___CxxFrameHandler3  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(wxutil.obj)    1   
Error   LNK2001 unresolved external symbol ___CxxFrameHandler3  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(combase.obj)   1   
Error   LNK2019 unresolved external symbol _wcsrchr referenced in function "wchar_t * __cdecl wcsrchr(wchar_t *,wchar_t)" (?wcsrchr@@YAPA_WPA_W_W@Z)    Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(dllentry.obj)  1   
Error   LNK2001 unresolved external symbol _wcsrchr Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(wxdebug.obj)   1   
Error   LNK2019 unresolved external symbol __imp____stdio_common_vswprintf referenced in function __vsnwprintf_l    Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(dllentry.obj)  1   
Error   LNK2001 unresolved external symbol __imp____stdio_common_vswprintf  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(wxdebug.obj)   1   
Error   LNK2001 unresolved external symbol __imp____stdio_common_vswprintf  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(dllsetup.obj)  1   
Error   LNK2001 unresolved external symbol __imp____stdio_common_vswprintf  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(wxutil.obj)    1   
Error   LNK2019 unresolved external symbol __imp____stdio_common_vsprintf referenced in function __vsnprintf_l  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(wxdebug.obj)   1   
Error   LNK2019 unresolved external symbol _memcpy referenced in function _AMGetWideString@8    Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(wxutil.obj)    1   
Error   LNK2001 unresolved external symbol _memcpy  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(mtype.obj) 1   
Error   LNK2001 unresolved external symbol _memcpy  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(amfilter.obj)  1   
Error   LNK2001 unresolved external symbol _memcpy  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(source.obj)    1   
Error   LNK2001 unresolved external symbol __purecall   Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(amfilter.obj)  1   
Error   LNK2001 unresolved external symbol __purecall   Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(source.obj)    1   
Error   LNK2019 unresolved external symbol __imp___wtoi referenced in function "public: virtual long __stdcall CSource::FindPin(wchar_t const *,struct IPin * *)" (?FindPin@CSource@@UAGJPB_WPAPAUIPin@@@Z) Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\strmbasd.lib(source.obj)    1   
Error   LNK2019 unresolved external symbol __CrtDbgReport referenced in function __CRT_RTC_INIT Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(init.obj)   1   
Error   LNK2019 unresolved external symbol __CrtDbgReportW referenced in function __CRT_RTC_INITW   Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(init.obj)   1   
Error   LNK2019 unresolved external symbol __callnewh referenced in function "void * __cdecl operator new(unsigned int)" (??2@YApaxI@Z) Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(new_scalar.obj) 1   
Error   LNK2019 unresolved external symbol _malloc referenced in function "void * __cdecl operator new(unsigned int)" (??2@YApaxI@Z)    Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(new_scalar.obj) 1   
Error   LNK2019 unresolved external symbol _strcpy_s referenced in function "void __cdecl _RTC_StackFailure(void *,char const *)" (?_RTC_StackFailure@@YAXpaxPBD@Z) Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(error.obj)  1   
Error   LNK2019 unresolved external symbol _strcat_s referenced in function "void __cdecl _RTC_StackFailure(void *,char const *)" (?_RTC_StackFailure@@YAXpaxPBD@Z) Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(error.obj)  1   
Error   LNK2019 unresolved external symbol ___stdio_common_vsprintf_s referenced in function __vsprintf_s_l Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(error.obj)  1   
Error   LNK2019 unresolved external symbol ___std_exception_copy referenced in function "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z)   Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(throw_bad_alloc.obj)    1   
Error   LNK2019 unresolved external symbol ___std_exception_destroy referenced in function "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(throw_bad_alloc.obj)    1   
Error   LNK2019 unresolved external symbol __CxxThrowException@8 referenced in function "void __cdecl __scrt_throw_std_bad_alloc(void)" (?__scrt_throw_std_bad_alloc@@YAXXZ)    Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(throw_bad_alloc.obj)    1   
Error   LNK2019 unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *)" (??3@YAXpax@Z)  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(delete_scalar.obj)  1   
Error   LNK2019 unresolved external symbol __wmakepath_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned int)" (?GetPdbDllPathFromFilePath@@YahpB_WPA_WI@Z)    Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(pdblkup.obj)    1   
Error   LNK2019 unresolved external symbol __wsplitpath_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,unsigned int)" (?GetPdbDllPathFromFilePath@@YahpB_WPA_WI@Z)   Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(pdblkup.obj)    1   
Error   LNK2019 unresolved external symbol _wcscpy_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,unsigned int)" (?GetPdbDllPathFromFilePath@@YahpB_WPA_WI@Z)    Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(pdblkup.obj)    1   
Error   LNK2019 unresolved external symbol ___vcrt_GetmodulefileNameW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPAUHINSTANCE__@@XZ)  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(pdblkup.obj)    1   
Error   LNK2019 unresolved external symbol ___vcrt_GetModuleHandleW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPAUHINSTANCE__@@XZ)    Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(pdblkup.obj)    1   
Error   LNK2019 unresolved external symbol ___vcrt_LoadLibraryExW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPAUHINSTANCE__@@XZ)  Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(pdblkup.obj)    1   
Error   LNK2019 unresolved external symbol _terminate referenced in function __except_handler4_noexcept Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(chandler4_noexcept.obj) 1   
Error   LNK2019 unresolved external symbol ___current_exception referenced in function __except_handler4_noexcept   Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(chandler4_noexcept.obj) 1   
Error   LNK2019 unresolved external symbol ___current_exception_context referenced in function __except_handler4_noexcept   Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(chandler4_noexcept.obj) 1   
Error   LNK2019 unresolved external symbol __except_handler4_common referenced in function __except_handler4    Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Filters\MSVCRTD.lib(chandler4gs.obj)    1   
Error   LNK1120 31 unresolved externals Filters C:\Users\alokm\tmp\tmhare.mvps.org-vcam\Bin\VCamD.ax    1   

我错在哪里?如何使其工作?

解决方法

构建项目的问题来自于此:

  1. 项目源代码依赖于 DirectShow BaseClasses,它不再是 Windows SDK 的一部分
  2. 项目有太多与默认值不同的设置;使用当前的 Visual Studio 就成了一个问题

我更新了 github repository 并更改了项目设置以使项目构建(Visual Studio 2019 社区)并运行:大多数 C++ 项目设置已恢复,并且 DirectShow BaseClasses 用于来自 github 的构建配置。

在那里查看 README.md,按照构建步骤(需要先提取 Windows SDK 示例,然后在那里构建 DirectShow 内容),注册 DLL(regsvr32),最后您将拥有生成视频的过滤器随机数据: