1

I get the following three errors after building a project that uses tinyXml2. The errors are shown in the attached image. The offending code can be found in tinyXml2's xtree.cs file, here:

template<class _Iter>
    void insert(_Iter _First, _Iter _Last)
    {   // insert [_First, _Last) one at a time
    _DEBUG_RANGE(_First, _Last);
    for (; _First != _Last; ++_First)
        {   // insert element as lvalue
        const value_type& _Val = *_First;
        insert(end(), _Val);
        }
    }

tinyXml2_Errors

I'm using (and must continue to use) VS2010

What could cause these errors?

1) error C2675: unary '++':'std::string' does not define this operator or a conversion to a type acceptable to the predefined operator

2) error C2100: illegal indirection

3)error C2440: 'initializing': cannot convert from 'std::string' to 'const std::pair<_Ty1,_Ty2> &'

Edit: included errors

OddLogic
  • 11
  • 5

1 Answers1

0

I commented everything in the class (and header) and added code until I received the error. This failure was actually not due to tinyXml2 - it was a failure to insert a string into a map.

For anyone else who has this problem in the future, here is the offending function, which generates no squiggly red lines in Visual Studio.

    map<string, string> createMap(CNintendoItem ni)
    {
    map<string, string> xmlNodeToValue;

    //ItemName is a string constant. ni.Name is a string returned from a class
    xmlNodeToValue.insert(ItemName, ni.Name);//name of the item

    ...//several more insertions

    return xmlNodeToValue;
}

One way to fix this is to use the following method to assign a value to a new key:

xmlNodeToValue[ItemName] = ni.Name;//name of the item
OddLogic
  • 11
  • 5