我在 Dev C++ 中为我的 C++ 项目解析 XML 文件,并且在 rapidxml_iterators.hpp 文件中有以下代码:
typedef xml_node<Ch> value_type;
typedef xml_node<Ch> &reference;
typedef xml_node<Ch> *pointer;
typedef typename std:: ptrdiff_t difference_type;
typedef typename std:: bidirectional_iterator_tag iterator_category;
它给了我这些错误:
no class template named `ptrdiff_t' in `std'
ISO C++ forbids declaration of `difference_type' with no type
no class template named `bidirectional_iterator_tag' in `std'
ISO C++ forbids declaration of `iterator_category' with no type
在得到这些错误之前,上面的代码如下:
typedef typename xml_node<Ch> value_type;
typedef typename xml_node<Ch> &reference;
typedef typename xml_node<Ch> *pointer;
typedef std:: ptrdiff_t difference_type;
typedef std:: bidirectional_iterator_tag iterator_category;
这给了我这样的嵌套名称说明符错误:
expected nested-name-specifier
`xml_node<Ch>' specified as declarator-id
two or more data types in declaration of `xml_node<Ch>'
expected `;' before "value_type"
在我进行解析的主文件中,我有以下内容:
#include <iostream>
#include "rapidxml.hpp"
#include "rapidxml_iterators.hpp"
#include "rapidxml_print.hpp"
#include "rapidxml_utils.hpp"
#include <iterator>
#include <istream>
#include <cstdlib>
#include <string>
#include <queue>
#include <vector>
#include <streambuf>
#include <cstddef>
我已经在这个网站上浏览过类似的帖子,我也听从了他们的建议,但到目前为止,他们都没有解决我的问题。是 Dev C++ 还是我的代码有问题?谢谢