下载地址

libcef最新的下载地址

官方文档

参考官方文档,内容如下:

Dynamic Linking (with a CEF DLL)
If you prefer to link CEF with your application dynamically then the process is faster. CEF provides a binary distribution on the downloads page that contains everything you need to link CEF with your application including source code for the libcef_dll_wrapper project. If your application does not use the /MT flag then you will need to rebuild the libcef_dll_wrapper project with the same flags as your application. Unlike with static linking, you will not need to rebuild all of CEF or Chromium in order to do this.

Download a CEF binary release from the project downloads page.
Run CMake with the additional -DCEF_RUNTIME_LIBRARY_FLAG=/MD command-line flag (/MD can be replaced with other flags as appropriate).
Open cef.sln in Visual Studio.
Right click on the libcef_dll_wrapper project and choose the "Project Only -> Build Only libcef_dll_wrapper" option.
Sandbox support (linking cef_sandbox.lib) is only possible when your application is built with the /MT flag.

编译

  • 下载解压需要的CEF版本包;
  • 使用cmake-gui(确保已正确安装cmake)生成工程文件,Generate 之前把 CEF_RUNTIME_LIBRARY_FLAG 由 / MT 改成 / MD,并把 USE_SANDBOX 取消勾选;
  • 用 VS 打开了生成的 cef.sln;
  • 编译 libcef_dll_wrapper。

ps:可能遇到问题:
error C2220: 警告被视为错误 - 没有生成 “object” 文件,解决方法配置属性 =》C/C++=》常规 =》将警告视为错误改为否 (/WX-)

使用

将Debug、Release、include、Resources以及刚刚编译的libcef_dll_wrapper中的库拷贝到需要使用的工程目录中,并配置好路径。


吴尼玛
32 声望11 粉丝

记问之学