cef no-visual-display

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

cef no-visual-display

Postby Veigar » Thu Feb 23, 2017 10:18 am

Hello there,

I've been playing with cef for few days and kind of stumbled into a problem with making run in windowless mode.
But I am facing some configuration/setup problems. The code I got bellow is more than trivial - take a look:

Code: Select all
#ifndef HEADLESS_CEF_H
#define HEADLESS_CEF_H

#pragma once

#include "include\cef_render_handler.h"
#include "include\cef_client.h"

class HeadlessCEF : public CefRenderHandler, public CefClient {

public:
   HeadlessCEF();
   ~HeadlessCEF();

   virtual void AddRef() const override;

   virtual bool Release() const override;

   virtual bool HasOneRef() const override;

   virtual bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect & rect) override;

   virtual void OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList & dirtyRects, const void * buffer, int width, int height) override;
};

#endif


Code: Select all
#include "HeadlessCEF.h"

HeadlessCEF::HeadlessCEF() { }

HeadlessCEF::~HeadlessCEF() { }

void HeadlessCEF::AddRef() const
{
}

bool HeadlessCEF::Release() const
{
   return false;
}

bool HeadlessCEF::HasOneRef() const
{
   return false;
}

bool HeadlessCEF::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect & rect)
{
   rect.Set(0, 0, 800, 600);
   return true;
}

void HeadlessCEF::OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList & dirtyRects, const void * buffer, int width, int height)
{
   std::wostringstream wss;
   SaveImage(browser, wss.str(), buffer, width, height); // implementation is removed
}


Now - my main function is like this: (a bare test)

Code: Select all
#include <iostream>
#include "HeadlessCEF.h"

int main() {

   std::cout << "working" << std::endl;

   CefWindowInfo info;
}


All this compiles just fine, but if I try to build - I get the error:
Unresolved external symbol _cef_string_utf_16_clear referenced in function "public: static void __cdecl CefWindowInfoTraits::clear .....


I am using CEF version 3.2924.
Also built this using Visual Studio 2015 and cmake.

This literaly looks like a configuration problem, just not sure how to find that.

Any ideas what I am doing wrong?

br,
Veig
Veigar
Newbie
 
Posts: 4
Joined: Thu Feb 23, 2017 9:55 am

Re: cef no-visual-display

Postby magreenblatt » Thu Feb 23, 2017 10:51 am

Are you linking libcef.lib in your configuration?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: cef no-visual-display

Postby Veigar » Thu Feb 23, 2017 11:12 am

magreenblatt wrote:Are you linking libcef.lib in your configuration?


Yes. I have the path included in "Additional Libraries Directories"
Basically I got this:
"\cef binary\Debug" and it contains libcef.lib and cef_sandbox.lib
I also have libcef_dll_wrapper.lib here too.
Veigar
Newbie
 
Posts: 4
Joined: Thu Feb 23, 2017 9:55 am

Re: cef no-visual-display

Postby magreenblatt » Thu Feb 23, 2017 12:23 pm

Setting Additional Libraries Directories is not sufficient. You need to explicitly specify the libraries to link under Linker > Input > Additional Dependencies.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: cef no-visual-display

Postby Veigar » Thu Feb 23, 2017 1:29 pm

magreenblatt wrote:Setting Additional Libraries Directories is not sufficient. You need to explicitly specify the libraries to link under Linker > Input > Additional Dependencies.


Excellent!
Now it seems the only thing is left with these:
2. mismatch detected for RuntimeLibrary: "value MT_StaticRelease does not match value MDd_StaticDebug in HeadlessCEF.obj'

I have everything set into debug so not sure where this statisrelease came from ...
Any thoughts what I might be missing?
Veigar
Newbie
 
Posts: 4
Joined: Thu Feb 23, 2017 9:55 am

Re: cef no-visual-display

Postby magreenblatt » Thu Feb 23, 2017 1:37 pm

If you're linking cef_sandbox.lib see the compiler flags that need to be set: https://bitbucket.org/chromiumembedded/ ... ake.in-347
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: cef no-visual-display

Postby Veigar » Tue Mar 07, 2017 3:54 am

I am only linking to the following:
libboost_date_time-vc140-mt-gd-1_63.lib
libboost_thread-vc140-mt-gd-1_63.lib
libboost_system-vc140-mt-gd-1_63.lib
libboost_chrono-vc140-mt-gd-1_63.lib
libcef.lib

So basically not even linking to libcef_dll_wrapper.lib. If I try to link to it too I get tons of errors like these:
"_ITERATOR_DEBUG_LEVEL': value: '0' does not match value '2' .
I check obj file of my project that is made and it indeed contains the value '2' for '_ITERATOR_DEBUG_LEVEL'.

It's basically not really clear what we need to link upon without spending hoursi n the code trying to figure out what is put where...
This is a trivial attempt to make something, but seems like the effort to make it work wont be that small :)
Veigar
Newbie
 
Posts: 4
Joined: Thu Feb 23, 2017 9:55 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 77 guests