c++ - TinyXml++ 教程中的错误

标签 c++ tinyxml++


试图编译 TinyXml++ tutorial使用 CodeBlocks (16.01) 和使用 VS2013,我在以下行遇到相同的错误:

ticpp::Element* pElem = doc.FirstChildElement()->NextSibling();

代码块错误:

invalid conversion from 'ticpp::Node*' to 'ticpp::Element*' [-fpermissive]

VS2013 错误:

cannot convert from 'ticpp::Node *' to 'ticpp::Element *'

有什么想法吗?

最佳答案

如果你还想编译,不管教程有没有错误,都可以使用auto关键字声明变量。

例如:

auto pElem = doc.FirstChildElement()->NextSibling();

这样,编译器将在编译时推导变量类型。

关于c++ - TinyXml++ 教程中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36997534/

相关文章:

c++ - 如何在 mac 中使用 gcc 链接到 carbon?

c++ - 使用 Visual Studio 2013 为 Platform Toolset v100 编译需要安装什么?

c++ - 如何配置 HttpEndRequest 的超时?

结构访问中的 C++ 数组

c++ - 来自 TinyXML++ 的奇怪行为

tinyxml - TinyXml 可以从字符串而不是文件加载 Xml 吗?

c++ - C++14 中的返回类型推导