c++ - RapidXML 的编译错误

标签 c++ rapidxml

我是 rapidXML 的新手,但第一印象并不积极,我制作了简单的 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)

最佳答案

我刚刚注意到您的错误与 rapidxml.cpp 有关。 那个文件是从哪里来的??

RapidXML 是一个只有 header 的库。没有 rapidxml.cpp,并且 rapidxml.hpp 无法自行编译 - 您只需将其包含在您自己的文件中(如 main.cpp 上面)来使用它。

我对 VC++ 一无所知,但尝试从 VC 项目中删除“rapidxml”并重新构建。

关于c++ - RapidXML 的编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2575376/

相关文章:

c++ - 使用 C++ AMP 时未命中 GPU 断点

c++ - 如何使用资源文件(txt - 制表符分隔)作为 win32 应用程序的数据源

c++ - 我如何比较cpp中的队列?

c++ - RapidXml 和内存池

c++ - C++ append_node 中 rapidXml 的奇怪结果

c++ - RapidXML 以深度优先模式解析 XML

c++ - float1 与 CUDA 中的 float

c++ - 我如何将 LPWSTR 解释为 Win32 调用中的输出参数?

C++ RapidXML - 编辑 XML 文件中的值

c++ - 使用快速 xml 查找子元素