新建空项目。这里以Debug版为例,使用cefsimple的代码作为本项目的代码。

按下面的目录结构组织文件。

image.png

输出目录:Bin\Debug

将...79.0.3945.130_windows32\Debug目录下的文件复制到此目录。

将...79.0.3945.130_windows32\Resources目录下的文件复制到此目录。

编译后得到TestLibCef.exe


字符集:使用 Unicode 字符集

附加包含目录:libcef

将...79.0.3945.130_windows32\include目录复制到此目录。


代码生成:多线程调试 (/MTd)【这里与libcef_dll_wrapper一致】

附加库目录:libcef\lib\Debug

将...79.0.3945.130_windows32\Debug目录下的cef_sandbox.lib,libcef.lib复制到此目录。

将Build\libcef_dll_wrapper\Debug\libcef_dll_wrapper.lib复制到此目录。


在simple_handler_win.cc中加入链接库。

#pragma comment(lib, "libcef.lib")

#pragma comment(lib, "libcef_dll_wrapper.lib")


Release版与Debug的设置方法一致。



本文链接地址: LibCef的使用2-创建项目
https://blog.qingfengju.com/index.asp?id=429

分类:Win32/C++ 查看次数:506 发布时间:2020/5/2 22:52:15

https://bitbucket.org/chromiumembedded/cef/src/master/

Chromium Embedded Framework (CEF)


已编译的二进制版本下载地址:

http://opensource.spotify.com/cefbuilds/index.html

下载日期:2020年05月17日

https://cef-builds.spotifycdn.com/index.html
下载日期:2023-11-01


本文下载的版本是:

...79.0.3945.130_windows32


开发环境:

Windows 7SP1,Cmake 3.16.4,VS2017


在CMake中生成VS2017,Win32项目。

image.png

打开Build/cef.sln,编译libcef_dll_wrapper,得到以下lib备用

Build\libcef_dll_wrapper\Debug\libcef_dll_wrapper.lib

Build\libcef_dll_wrapper\Release\libcef_dll_wrapper.lib


其中的cefsimple等示例项目无法编译为Debug版本(与sandbox有关,且可能是VS2017的bug),Release版没有出现错误。

会收到错误1:

mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file

参见:

https://bitbucket.org/chromiumembedded/cef/issues/2725 John Chang的答案


临时的解决方法为:

(1) 生成调试信息:否

(2) 勾掉USE_ATL和USE_SANDBOX 【未验证】


运行时会收到错误2:

PowerDeterminePlatformRoleEx not found in POWRPROF.DLL

临时的解决方法为:

在链接参数中添加 /DELAYLOAD:powrprof.dll


参见:

https://bitbucket.org/chromiumembedded/cef/issues/2908/windows-7-debug-sandbox-build-fails-with Marshall Greenblatt的答案


另外os_rendering_unittest.cc有不能识别的字符,需要把编码改为 UTF-8 Signature。


Chrome最后一个支持XP的版本是 49.0.2623.112

CEF对应的分支版本是 2623

地址:https://bitbucket.org/chromiumembedded/cef/branch/2623

git clone -b 2623 https://bitbucket.org/chromiumembedded/cef.git


最简单的例子:

https://bitbucket.org/chromiumembedded/cef/src/master/tests/cefsimple/?at=master


Cef使用方法Wiki:

https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage.md

https://bitbucket.org/chromiumembedded/cef/wiki/Home



本文链接地址: LibCef的使用1-下载,libcef_dll_wrapper的编译
https://blog.qingfengju.com/index.asp?id=428

分类:Win32/C++ 查看次数:671 发布时间:2020/5/1 22:49:21