gpt4 book ai didi

c++ - RapidXML 的编译错误

转载 作者:行者123 更新时间:2023-11-30 01:31:52 44 4
gpt4 key购买 nike

我是 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/

44 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com