我试图理解为什么在尝试编译此代码时收到警告 -Wsubobject-linkage:
\n基本.hh
\n#pragma once\n\n#include <iostream>\n\ntemplate<char const *s>\nclass Base\n{\npublic:\n void print()\n {\n std::cout << s << std::endl;\n }\n};\nRun Code Online (Sandbox Code Playgroud)\n孩子.hh
\n#pragma once\n\n#include "base.hh"\n\nconstexpr char const hello[] = "Hello world!";\n\nclass Child : public Base<hello>\n{\n};\nRun Code Online (Sandbox Code Playgroud)\n主程序.cc
\n#include "child.hh"\n\nint main(void)\n{\n Child c;\n c.print();\n return 0;\n}\nRun Code Online (Sandbox Code Playgroud)\n跑步时g++ main.cc I get this warning:
In file included from main.cc:1:\nchild.hh:7:7: warning: \xe2\x80\x98Child\xe2\x80\x99 has a base \xe2\x80\x98Base<(& hello)>\xe2\x80\x99 whose type uses the anonymous namespace [-Wsubobject-linkage]\n 7 | class Child : …Run Code Online (Sandbox Code Playgroud) 我正在开发Windows Phone 8.1应用程序.我有一个WebBrowser类的InvokeScript方法的问题.我在我的XAML中有这个:
当我运行此代码时:
myWebBrowser.Loaded += (object sender, RoutedEventArgs e) =>
{
webBrowser.IsScriptEnabled = true;
webBrowser.InvokeScript("eval", "alert('foo')");
};
Run Code Online (Sandbox Code Playgroud)
我在使用InvokeScript的行上得到一个System.SystemException,它告诉我:
出现未知错误.错误:80020006.
当我为Windows Phone 8(而不是8.1)运行相同的代码时,我没有得到异常.
有什么想法我为什么会在WP 8.1中出错?