Rapidxml没有在Visual Studio 2010上编译。我做错了什么?

时间:2011-01-20 15:52:33

标签: c++ visual-studio-2010 rapidxml

我正在努力在我们的代码库中将XML解析器从TinyXml切换到RapidXml。

但是,RapidXml似乎无法使用Visual Studio 2010进行编译。

基本上,在我正在做的头文件中

#define RAPIDXML_NO_EXCEPTIONS
#include "RapidXml/rapidxml.hpp"
using namespace rapidxml;

并在实施中

xml_document<> xmlDoc;
xmlDoc.parse<0>(filestring);

就在那里,在我的第二行代码中,Visual Studio说

  

c:\ users \ name \ development \ rapidxml \ rapidxml.hpp(420):错误C2061:语法错误:标识符'内存'
  1 GT; c:\ users \ name \ development \ rapidxml \ rapidxml.hpp(418):同时编译类模板成员函数'rapidxml :: xml_node&lt;&gt; * rapidxml :: memory_pool :: allocate_node(rapidxml :: node_type,const Ch *,const Ch *,size_t,size_t)'
  1 GT;与
  1 GT; [
  1 GT; CH =字符
  1 GT; ]
  1 GT; c:\ users \ name \ development \ rapidxml \ rapidxml.hpp(1359):参见正在编译的类模板实例化'rapidxml :: memory_pool'的引用   1 GT;与
  1 GT; [
  1 GT; CH =字符
  1 GT; ]
  1 GT; c:\ users \ name \ development \ xmlresource.cpp(70):请参阅类模板实例化'rapidxml :: xml_document&lt;&gt;'正在编制

这是一个漫长的编码日的结束,这就是今天的情况。那些知识渊博的人有没有想到我在这里做错了什么?

2 个答案:

答案 0 :(得分:1)

以下是我使用的一些示例代码,也许会有所帮助?

   #include <rapidxml.hpp>

   rapidxml::xml_document<> doc;
   doc.parse<rapidxml::parse_no_data_nodes | rapidxml::parse_trim_whitespace>( buffer );

   rapidxml::xml_node<>* root;
   root = doc.first_node();
   if ( root )
   {
      rapidxml::xml_node<>* cur_node;

      cur_node = root->first_node( "SessionLoginDeadline" );
      if ( cur_node )
         SessionLoginDeadline = cur_node->value();

      cur_node = root->first_node( "Port" );
      if ( cur_node )
         Port = stringTo<unsigned short>( cur_node->value() );

      cur_node = root->first_node( "MaximumAllowedClients" );
      if ( cur_node )
         MaximumAllowedClients = stringTo<unsigned short>( cur_node->value() );
   }

答案 1 :(得分:1)

这是我的实际问题:

作为一些内存调试的一部分,我使用不支持placement new的版本重载了new。但是,rapidxml确实需要新的工作,因此这些错误来自于此。哦,我的。