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