CEF Windows Development Environment Setup

Source: Internet
Author: User

Cef,chromium the abbreviation for the Embedded framework. CEF's official website introduces simplicity: A simple framework for embedding Chromium browser windows in other applications. Specifically, a framework that embeds browser functionality (page rendering, JS execution) into other applications. Interested to see here: HTTPS://BITBUCKET.ORG/CHROMIUMEMBEDDED/CEF.

The advantage of CEF is that the development of web and native hybrid applications is very convenient, much better than calling the Windows IE components, at least with the application to carry a stable version of the Chrominum, and IE version too much, your application relies on the user's operating system, various compatibility pits ...

It took a long time, and finally ran through the small example of cefsimple. Record the process.

Tools

My pairing:

    • VS 2013
    • CMake 3.4.1
    • CEF 3.2357.1271 (binary package for csdn download channel)

I extracted CEF Binary for Windows into this directory: D:\PROJECTS\CEF_BINARY_3.2357.1271.G8E0674E_WINDOWS32, we use Cefdir instead.

There is no VS project and solution in CEF binary now, you have to generate it yourself.

Environment configuration and compilation process

The cefsimple example relies on libcef_dll_wrapper and needs to compile the Libcef_dll project first.

Compiling Libcef_dll
    1. Download CMake 3.4.1 (cmake-3.4.1-win32-x86.zip) to https://cmake.org/download/
    2. Unzip to a directory, I here is E:\software\cmake-3.4.1-win32-x86, back useful your-cmake-dir refer to. Open the command line (Cmd.exe) and execute the "set path=your-cmake-dir/bin;%path%" command.
    3. Switch to the Cefdir/libcef_dll directory and execute "CMake." command to generate VS 2013 project files and solution files
    4. Use vs 2013 to open the Project.sln in the Cefdir/libcef_dll directory, check libcef_dll_wrapper this project, open the project properties, set the C + + add-in directory, add the Cefdir directory
    5. Select Libcef_dll_wrapper, right mouse button, properties –> configuration Properties –>c/c++–> preprocessor definition, edit, add a Nominmax macro. This is to resolve the Min/max macro conflicts defined by Std::min/std::max and VC globally. Some cc files in Libcef_dll use the Std::min/max template function, do not add Nominmax, C2589 and C2059 errors may occur
    6. Debug version, runtime select "Multithreaded Debugging (MTd)"; release version select Mt.
    7. Compiling, generating libcef_dll_wrapper.lib files
    8. Put the Libcef_dll_wrapper.lib in the Cefdir/release (or debug) directory

I encountered some errors in compiling and found the solution, which is already included in the above steps.

Compiling the Cefsimple sample

With the Libcef_dll_wrapper, you can compile the cefsimple.

I originally wanted to use CMake generation, the results toss half a day, CMake executed, but did not generate the corresponding cefsimple.vcxproj ... Had to create a VS project manually.

The process is as follows:

    1. Create a Cefsimple project yourself, Win32 type, empty project
    2. Add cefsimple_win.cc,simple_app.cc,simple_handler.cc,simple_handler_win.cc as a source file to the project
    3. Add Resource.h,simple_app.h,simple_handler.h as a header file to the project
    4. Set up an additional inclusion directory and add the Cefdir directory
    5. Set up additional library directories, cefdir/release (or Debug)
    6. Add additional dependencies, adding Libcef_dll_wrapper.lib, Libcef.lib, DbgHelp.lib
    7. simple_app.cc in www.google.com replaced with www.baidu.com (Google can't open Ah ...) )
    8. Debug version, runtime select "Multithreaded Debugging (MTd)"; release version select Mt. Note that the choice here, and libcef_dll to be consistent, or will be out of link error
    9. Set the working directory to cefdir/release (or debug)
    10. Compile run

The runtime may crash and copy the contents of the Cefdir/resources directory to cef/release (or debug). CEF needs icudtl.dat, language files and so on.

Operating effects such as:

Cefdir Directory has a README.txt file, be sure to see, I compiled through after running the total crash, in the VS 1.1 point debug, see the program output, took a long time to find the resources of the problem!

OK, the environment is so good, then you can study the CEF SDK.

CEF Windows Development Environment Setup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.