我是rapidXML的新手,但是第一个impresion不是正面的,我做了简单的Visual Studio 6 C ++ Hello World应用程序,并将RapidXML hpp文件添加到项目中,并在main.cpp中添加:
#include "stdafx.h"
#include < iostream >
#include < string >
#include "rapidxml.hpp"
using namespace std;
using namespace rapidxml;
int main ( )
{
char x[] = "<Something>Text</Something>\0" ; //<<<< funktioniert, aber mit '*' nicht
xml_document<> doc ;
doc.parse<0>(x) ;
cout << "Name of my first node is: " << doc.first_node()->name() << endl ;
xml_node<>* node = doc.first_node("Something") ;
cout << "Node 'Something' has value: " << node->value() << endl ;
}
它没有编译,任何帮助? RapidXML可以与Visual Studio 6一起运行吗? 我得到的错误是:
--------------------Configuration: aaa - Win32 Debug--------------------
Compiling...
rapidxml.cpp
c:\Parser\rapidxml.cpp(310) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(320) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(320) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(385) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(639) : see reference to class template instantiation 'rapidxml::memory_pool<Ch>' being compiled
c:\Parser\rapidxml.cpp(417) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(639) : see reference to class template instantiation 'rapidxml::memory_pool<Ch>' being compiled
c:\Parser\rapidxml.cpp(417) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(639) : see reference to class template instantiation 'rapidxml::memory_pool<Ch>' being compiled
c:\Parser\rapidxml.cpp(448) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(639) : see reference to class template instantiation 'rapidxml::memory_pool<Ch>' being compiled
c:\Parser\rapidxml.cpp(448) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(639) : see reference to class template instantiation 'rapidxml::memory_pool<Ch>' being compiled
c:\Parser\rapidxml.cpp(476) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(639) : see reference to class template instantiation 'rapidxml::memory_pool<Ch>' being compiled
c:\Parser\rapidxml.cpp(579) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(639) : see reference to class template instantiation 'rapidxml::memory_pool<Ch>' being compiled
c:\Parser\rapidxml.cpp(599) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(639) : see reference to class template instantiation 'rapidxml::memory_pool<Ch>' being compiled
c:\Parser\rapidxml.cpp(681) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(790) : see reference to class template instantiation 'rapidxml::xml_base<Ch>' being compiled
c:\Parser\rapidxml.cpp(700) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(790) : see reference to class template instantiation 'rapidxml::xml_base<Ch>' being compiled
c:\Parser\rapidxml.cpp(721) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(790) : see reference to class template instantiation 'rapidxml::xml_base<Ch>' being compiled
c:\Parser\rapidxml.cpp(751) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(790) : see reference to class template instantiation 'rapidxml::xml_base<Ch>' being compiled
c:\Parser\rapidxml.cpp(786) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(790) : see reference to class template instantiation 'rapidxml::xml_base<Ch>' being compiled
c:\Parser\rapidxml.cpp(787) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(790) : see reference to class template instantiation 'rapidxml::xml_base<Ch>' being compiled
c:\Parser\rapidxml.cpp(836) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(876) : see reference to class template instantiation 'rapidxml::xml_attribute<Ch>' being compiled
c:\Parser\rapidxml.cpp(856) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(876) : see reference to class template instantiation 'rapidxml::xml_attribute<Ch>' being compiled
c:\Parser\rapidxml.cpp(936) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(1345) : see reference to class template instantiation 'rapidxml::xml_node<Ch>' being compiled
c:\Parser\rapidxml.cpp(958) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(1345) : see reference to class template instantiation 'rapidxml::xml_node<Ch>' being compiled
c:\Parser\rapidxml.cpp(981) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(1345) : see reference to class template instantiation 'rapidxml::xml_node<Ch>' being compiled
c:\Parser\rapidxml.cpp(1004) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(1345) : see reference to class template instantiation 'rapidxml::xml_node<Ch>' being compiled
c:\Parser\rapidxml.cpp(1025) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(1345) : see reference to class template instantiation 'rapidxml::xml_node<Ch>' being compiled
c:\Parser\rapidxml.cpp(1045) : error C2039: 'size_t' : is not a member of 'std'
c:\Parser\rapidxml.cpp(1345) : see reference to class template instantiation 'rapidxml::xml_node<Ch>' being compiled
Error executing cl.exe.
rapidxml.obj - 25 error(s), 0 warning(s)
答案 0 :(得分:3)
我刚注意到您的错误与rapidxml.cpp
有关。 该文件来自哪里?
RapidXML是一个仅限标头的库。没有rapidxml.cpp
,rapidxml.hpp
无法自行编译 - 您只需将其包含在您自己的文件中(例如上面的main.cpp
)即可使用它。
我对VC ++一无所知,但尝试从VC项目中删除“rapidxml”并重建。
答案 1 :(得分:2)
Visual C ++ 6可追溯到C ++语言标准化之前。如果你在使用它编译甚至含糊不清的现代代码时遇到问题,那么问题的可能性在于编译器而不是代码。这些问题通常无法修复 - 您可能需要升级到更现代的编译器。
答案 2 :(得分:0)
这在技术上并不合法,但您可以尝试在#include "rapidxml.hpp"
行上方插入以下代码:
namespace std
{
typedef unsigned long size_t;
}
在RapidXML尝试使用它之前,这将(非法)将size_t
注入std
命名空间。如果这实际上是编译的,那么您可以搜索VC6头文件以找出size_t
的真实定义是什么,并替换上面的unsigned long
。