Using SWebBrowser in game causes build errors

Based on some posts (How to bind UObject to WebBrowser? - Programming & Scripting - Epic Developer Community Forums) it is possible to communicate from c++ to javascript by using SWebBrowser (the c++/javascript connection is my ultimate goal. If you know better way to achieve it, please tell me).

Following the post, I try to create a SWebBrowser instance. However, immediately when I include the SWebBrowser.h into my class file, I get loads of build errors, starting like this:

CompilerResultsLog: Error: e:\ue42\unrealengine\engine\source\runtime\webbrowser\public\IWebBrowserSingleton.h(33) : error C2079: 'FBrowserContextSettings' uses undefined struct 'WEBBROWSER_API'
CompilerResultsLog: Error: e:\ue42\unrealengine\engine\source\runtime\webbrowser\public\IWebBrowserSingleton.h(34) : error C2143: syntax error: missing ')' before 'const'
CompilerResultsLog: Error: e:\ue42\unrealengine\engine\source\runtime\webbrowser\public\IWebBrowserSingleton.h(34) : error C2064: term does not evaluate to a function taking 0 arguments
CompilerResultsLog: Error: e:\ue42\unrealengine\engine\source\runtime\webbrowser\public\IWebBrowserSingleton.h(34) : error C2059: syntax error: 'const'

So it seems I do not know how to include a slate class in my program properly. I already added the module dependencies like this

	PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

There seems to be no example projects around that would show how to use SWebBrowser in game.

Undoubtedly this is an UE newbie error. Can you help?

Hi Teleporno,

SWebBrowser is not part of the Slate modules, it is part of the WebBrowser module. You need to add that as a dependency to be able to access it.

Thanks for your reply! I would accept it but I was too slow :slight_smile: