I have an odd error I can't figure out. I am using Awesomium(latest ver) with C++ and I want to create a listener to connect the JS to the running program.
我有一个奇怪的错误,我无法弄清楚。我正在使用带有C ++的Awesomium(最新版本),我想创建一个将JS连接到正在运行的程序的监听器。
I have included the /include and /lib folders correctly, I am also including necessary headers
我已正确包含/ include和/ lib文件夹,我还包括必要的标头
#include <Awesomium/WebCore.h>
#include <Awesomium/STLHelpers.h>
#include <Awesomium/JSObject.h>
#include <Awesomium/WebViewListener.h>
However, visual studio keeps saying there's something wrong with my code
但是,visual studio一直在说我的代码有问题
class BrowserListener : public Awesomium::WebViewListener
{
public:
virtual void onCallback(Awesomium::WebView* caller, const std::wstring& objectName,
const std::wstring& callbackName, const Awesomium::JSArray& args)
{
// Check starts here
if (objectName == L"app" && callbackName == L"settings") {
std::cout << "callback called with " << args.size() << " args\n";
}
}
};
It underlines Awesomium::WebViewListener as red, saying: Namespace Awesomium, not a class or struct name. Namespace Awesomium has no member class WebViewListener
它将Awesomium :: WebViewListener强调为红色,说:Namespace Awesomium,而不是类或结构名称。命名空间Awesomium没有成员类WebViewListener
This is the part I can't solve, please help :)
这是我无法解决的部分,请帮忙:)
edit: to be clear, I am able to use awesomium to load sites as intended. It's just the listener object that refuses to work
编辑:要清楚,我可以使用awesomium按预期加载网站。它只是拒绝工作的监听器对象
1 个解决方案
#1
WebViewListener
is a namespace nested in the Awesomium
namespace, not a class. Change the base class to Awesomium::WebViewListener::Load
.
WebViewListener是嵌套在Awesomium名称空间中的名称空间,而不是类。将基类更改为Awesomium :: WebViewListener :: Load。
#1
WebViewListener
is a namespace nested in the Awesomium
namespace, not a class. Change the base class to Awesomium::WebViewListener::Load
.
WebViewListener是嵌套在Awesomium名称空间中的名称空间,而不是类。将基类更改为Awesomium :: WebViewListener :: Load。