Windows中集成libcef(MD)

本文介绍了如何从项目下载页面获取并动态链接libcef,包括使用CMake配置、在VisualStudio中编译libcef_dll_wrapper,以及处理可能遇到的警告和Sandbox支持设置。

下载地址

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中的库拷贝到需要使用的工程目录中,并配置好路径。

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值