libcef作为当下最流行的嵌入式浏览器,有着蓬勃发展的趋势,但是它的下载地址在不断变化,本文提供现今位置最新的下载地址:https://cef-builds.spotifycdn.com/index.html#windows64 另一方面将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.
1.下载解压CEF,我这里使用的是cef_binary_74.1.19+gb62bacf+chromium-74.0.3729.157_windows64; 2.下载安装CMake,我这里使用的是cmake-3.11,Generate之前需要修改CMake的两项,需要把CEF_RUNTIME_LIBRARY_FLAG由/MT改成/MD,并把USE_SANDBOX取消勾选,因为官方也说了,这个看起来负责安全的沙箱,只能用/MT编; 3.用VS15打开了生成的cef.sln; 4.这里只需要编libcef_dll_wrapper就可以了,生成的还是静态库,不要改成动态链接库,其他几个demo、test的项目也可以一块编了,生成解决方案遇到的全部问题: (1)error C2039: “unique_ptr”: 不是“std”的成员,解决方法加#include (2)error C2220: 警告被视为错误 - 没有生成“object”文件,解决方法配置属性=》C/C++=》常规=》将警告视为错误改为否 (/WX-) (3)error C2001: 常量中有换行符,原因有日文,解决方法删掉…
合理的脚本代码可以有效的提高工作效率,减少重复劳动。