Before you do anything else, try and remove the line:-
#include "rapidxml_iterators.hpp"
It's not normally necessary - you can use rapidxml perfectly without it, and from what I recall it's a source of much pain and weird compiler errors.
Question
I am parsing an XML file for my C++ project in Dev C++ and I have the following code in the rapidxml_iterators.hpp file:
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;
It is giving me these errors:
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
Prior to getting these errors, the code above was as follows:
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;
Which gave me the nested-name specifier errors like this:
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"
In my main file, which is where I'm doing the parsing, I have the following includes:
#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>
I have already looked around this website for similar posts and I have followed their advice but none of them have so far solved my problem. Is it a problem with Dev C++ or with my code? Thank you
Solution
Before you do anything else, try and remove the line:-
#include "rapidxml_iterators.hpp"
It's not normally necessary - you can use rapidxml perfectly without it, and from what I recall it's a source of much pain and weird compiler errors.