首页 > 解决方案 > 如何使用 Visual Studio 2017 编译 CEF 库?

问题描述

我关注了 Sga 的回答How to use Chromium Embedded Framework with Visual Studio 2017 (C++)? 用 Visual Studio 2017 编译 Cef。但是,当我按照他的步骤 7 构建调试/发布时,我收到以下错误:

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol _CLSID_WbemLocator referenced in function "bool __cdecl base::win::CreateLocalWmiConnection(bool,class Microsoft::WRL::ComPtr<struct IWbemServices> *)" (?CreateLocalWmiConnection@win@base@@YA_N_NPAV?$ComPtr@UIWbemServices@@@WRL@Microsoft@@@Z)   cefsimple   C:\Users\BremeyeT\source\repos\cef_binary_3.3538.1849.g458cc98_windows32\build\tests\cefsimple\cef_sandbox.lib(wmi.obj) 1   
Error   LNK1120 1 unresolved externals  cefsimple   C:\Users\BremeyeT\source\repos\cef_binary_3.3538.1849.g458cc98_windows32\build\tests\cefsimple\Debug\cefsimple.exe  1   
Error   LNK2019 unresolved external symbol _CLSID_WbemLocator referenced in function "bool __cdecl base::win::CreateLocalWmiConnection(bool,class Microsoft::WRL::ComPtr<struct IWbemServices> *)" (?CreateLocalWmiConnection@win@base@@YA_N_NPAV?$ComPtr@UIWbemServices@@@WRL@Microsoft@@@Z)   cefclient   C:\Users\BremeyeT\source\repos\cef_binary_3.3538.1849.g458cc98_windows32\build\tests\cefclient\cef_sandbox.lib(wmi.obj) 1   
Error   LNK1120 1 unresolved externals  cefclient   C:\Users\BremeyeT\source\repos\cef_binary_3.3538.1849.g458cc98_windows32\build\tests\cefclient\Debug\cefclient.exe  1   
Error   LNK2019 unresolved external symbol _CLSID_WbemLocator referenced in function "bool __cdecl base::win::CreateLocalWmiConnection(bool,class Microsoft::WRL::ComPtr<struct IWbemServices> *)" (?CreateLocalWmiConnection@win@base@@YA_N_NPAV?$ComPtr@UIWbemServices@@@WRL@Microsoft@@@Z)   ceftests    C:\Users\BremeyeT\source\repos\cef_binary_3.3538.1849.g458cc98_windows32\build\tests\ceftests\cef_sandbox.lib(wmi.obj)  1   
Error   LNK1120 1 unresolved externals  ceftests    C:\Users\BremeyeT\source\repos\cef_binary_3.3538.1849.g458cc98_windows32\build\tests\ceftests\Debug\ceftests.exe

这个问题我了解到它与 wbemuuid.lib 有关。所以我加了

$(UniversalCRT_LibraryPath_x86)..\..\um\x86

到项目 cefclient、cefsimple 和 ceftests 的库目录,因为这是我在驱动器上找到 wbemuuid.lib 的地方。但是 Cef 库仍然没有成功编译并显示相同的错误。

我确实检查了我正在编译库的 Win32 版本,并且 wbemuuid.lib 是 32 位版本。

我还需要做什么才能获得成功的编译和链接?

标签: c++visual-studio-2017chromium-embedded

解决方案


您需要与 wbemuuid.lib 链接


推荐阅读