RapidXML的编译错误 我是RAPIDXML的新手,但第一印象不是肯定的,我制作了简单的Visual Studio 6 C++的Hello World应用程序,并在项目和Min中添加了RAPIDXML XPP文件。 #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的编译错误 我是RAPIDXML的新手,但第一印象不是肯定的,我制作了简单的Visual Studio 6 C++的Hello World应用程序,并在项目和Min中添加了RAPIDXML XPP文件。 #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 ; },c++,rapidxml,C++,Rapidxml,它不编译,有什么帮助吗?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\rapidxm

它不编译,有什么帮助吗?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)

Visual C++ 6可以追溯到C++语言标准化之前。如果您在用它编译甚至是模糊的现代代码时遇到问题,那么问题可能在于编译器,而不是代码。这些问题通常无法修复——你可能需要升级到更现代的编译器。

VisualC++ 6可以追溯到C++语言被标准化之前。如果您在用它编译甚至是模糊的现代代码时遇到问题,那么问题可能在于编译器,而不是代码。此类问题通常无法修复-您可能需要升级到更现代的编译器。

这在技术上是不合法的,但您能否尝试在include rapidxml.hpp行上方插入以下代码:


这将在RapidXML尝试使用std名称空间之前非法将大小\u t注入该名称空间。如果确实可以编译,那么您可以搜索VC6头文件,找出大小的真正定义,并替换上面的unsigned long。

这在技术上是不合法的,但是您可以尝试在include rapidxml.hpp行上方插入以下代码吗:


这将在RapidXML尝试使用std名称空间之前非法将大小\u t注入该名称空间。如果确实可以编译,那么您可以搜索VC6头文件,找出大小的真正定义,并替换上面的unsigned long。

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

RapidXML是一个只有标题的库。没有rapidxml.cpp,rapidxml.hpp不能单独编译-您只需将其包含在您自己的文件中,如上面的main.cpp中,即可使用它


我对VC++一无所知,但请尝试从VC项目中删除rapidxml并重新生成。

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

RapidXML是一个只有标题的库。没有rapidxml.cpp,rapidxml.hpp不能单独编译-您只需将其包含在您自己的文件中,如上面的main.cpp中,即可使用它


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

因为我只是这项parsig业务的新手,所以我确信这是我的错误。。。让我们看看其他人是怎么想的。错误在于VC++6.0显然无法编译RapidXM,与您自己的代码无关。鉴于RapidXML项目是在VC++6发布8年后开始的,这并不奇怪。其他人怎么想都无所谓。获得新的Visual Studio需要成本。。。所以我宁愿等待任何其他的意见:我仍然没有检查,但我得到的信息就像你尼尔告诉我的一样。似乎编译器太旧了。因为我只是这个parsig行业的新手,我确实认为这是我的错误。。。让我们看看其他人是怎么想的。错误在于VC++6.0显然无法编译RapidXM,与您自己的代码无关。鉴于RapidXML项目是在VC++6发布8年后开始的,这并不奇怪。其他人怎么想都无所谓。获得新的Visual Studio需要成本。。。所以我宁愿等待任何其他的意见:我仍然没有检查,但我得到的信息和你们尼尔告诉我的一样。似乎编译器太旧了。我不允许发送完整的错误列表,但我得到了这个。我把你们说的放在main中,而不是放在rapidxml.hpp文件中:rapidxml.cpp rapidxml_iterators.cppc:_milan\tools\aaa\rapidxml_iterators.cpp24:错误C2039:“ptrdiff_t”:不是“std”的成员c:_milan\tools\aaa\rapidxml_iterators.cpp91:请参阅正在编译的类模板实例化“rapidxml::node_iterator”。我认为ptrdiff_t可能与大小相同。将另一个typedef添加到您的命名空间中,然后重试。我不允许发送完整的错误列表,但我得到了此消息。我将您所说的先放在main中,然后放在rapidxml.hpp文件中:rapidxml.cpp rapidxml\u iterators.cpp c:\u milan\tools\aaa\rapidxml\u iterators.cpp24:错误C2039:'ptrdiff\u t':不是“std”的成员c:_milan\tools\aaa\rapidxml_iterators.cpp91:请参阅正在编译的类模板实例化'rapidxml::node_iterator'的参考。我认为ptrdiff_t可能与size_t相同。将另一个typedef添加到您的命名空间并重试。目前,Boost库使用rapidxml作为XML解析器。如果您愿意,可以看看Boost代码。目前,Boost库使用rapidxml作为XML解析器。如果您喜欢,可以看看Boost代码。我在cpp中重命名了rapidxml.hpp,这不对吗?最后应该用同一个编译器来编译,对吗?我使用名称空间rapidxml从main.cpp中删除;正如您所说,但仍然有错误:删除中间层
“RapidXMLParser-Win32调试”项目的te文件和输出文件----------配置:RapidXMLParser-Win32调试----------编译。。。main.cpp c:_milan\tools\rapidxmlparser\rapidxml.hpp312:错误C2039:'size\u t':不是'std'的成员c:_milan\tools\rapidxmlparser\rapidxml.hpp322:错误C2039:'size\t':不是'std'的成员@米兰:我在cpp中重命名了rapidxml.hpp,这是错误的吗?对100%错了。它只是一个头文件。这就是你所需要的。通过删除rapidxml,我的意思是*从VS项目中删除文件rapidxml.cpp,而不是删除“使用命名空间rapidxml”行。编译现在可以工作,但主文件中的函数:doc.first_node->name会导致异常访问冲突。当我调试时,异常发生在函数:Ch*name const{return m_name?m_name:nullstr;}中,其中调试器中的变量m_name显示以下值:m_name CXX0030:错误:无法计算表达式任何线索在这个简单的情况下有什么错误?米兰,我在cpp中重命名了rapidxml.hpp,错了吗?最后应该用同一个编译器来编译,对吗?我使用名称空间rapidxml从main.cpp中删除;正如您所说,但仍然出现错误:删除项目“RapidXMLParser-Win32 Debug”的中间文件和输出文件----------配置:RapidXMLParser-Win32调试----------编译。。。main.cpp c:_milan\tools\rapidxmlparser\rapidxml.hpp312:错误C2039:'size\u t':不是'std'的成员c:_milan\tools\rapidxmlparser\rapidxml.hpp322:错误C2039:'size\t':不是'std'的成员@米兰:我在cpp中重命名了rapidxml.hpp,这是错误的吗?对100%错了。它只是一个头文件。这就是你所需要的。通过删除rapidxml,我的意思是*从VS项目中删除文件rapidxml.cpp,而不是删除“使用命名空间rapidxml”行。编译现在可以工作,但主文件中的函数:doc.first_node->name会导致异常访问冲突。当我调试时,异常发生在函数:Ch*name const{return m_name?m_name:nullstr;}中,其中调试器中的变量m_name显示以下值:m_name CXX0030:错误:无法计算表达式任何线索在这个简单的情况下有什么错误?比尔,米兰。
namespace std
{
    typedef unsigned long size_t;
}