没有用于调用 'TiXmlElement::TiXmlElement(std::_cxx11::string&) 的匹配函数
no matching function for call to 'TiXmlElement::TiXmlElement(std::_cxx11::string&)
for (int i = g, x=0; i < counter - 1 && x < 99; i++,x++){
std::string point = std::to_string(i);
std::string pointx = std::to_string(point_vec[i].x);
std::string pointy= std::to_string(point_vec[i].y);
TiXmlElement* P = new TiXmlElement( point );
TiXmlText* X = new TiXmlText(pointx);
doc.LinkEndChild(X);
TiXmlText* Y = new TiXmlText(pointy);
doc.LinkEndChild(Y);
doc.LinkEndChild(P);
}
以上是我现在正在尝试处理的示例代码,我的问题是它告诉我以下内容:
"error: no matching function for call to 'TiXmlElement::TiXmlElement(std::_cxx11::string&)" 这是在 c++ 上使用 wxwidgets,使用 tinyxml 背后的想法是能够存储数组并在之后重用它们。
解决了这个问题:我不得不进入 tinyxml.h 并在顶部添加这个:#define TIXML_USE_STL
string/char类型有两个构造函数如下:
TiXmlElement::TiXmlElement (const char * _value)
或
#ifdef TIXML_USE_STL
TiXmlElement::TiXmlElement( const std::string& _value )
所以你必须定义 TIXML_USE_STL 如果你想使用 std::string
否则使用 const char *
参考tinyxml.cpp
如前所述,没有与 TiXmlElement(std::_cxx11::string&)
匹配的函数,据我所知,它是来自 c11 标准化的一些字符串 class。在这种情况下,它将恰好是 point
字符串。尝试检查是否有一种方法可以使用 TiXmlElement 的字符串,正如错误所说,你提供了一个错误的实例 class std::_cxx11::string&
for (int i = g, x=0; i < counter - 1 && x < 99; i++,x++){
std::string point = std::to_string(i);
std::string pointx = std::to_string(point_vec[i].x);
std::string pointy= std::to_string(point_vec[i].y);
TiXmlElement* P = new TiXmlElement( point );
TiXmlText* X = new TiXmlText(pointx);
doc.LinkEndChild(X);
TiXmlText* Y = new TiXmlText(pointy);
doc.LinkEndChild(Y);
doc.LinkEndChild(P);
}
以上是我现在正在尝试处理的示例代码,我的问题是它告诉我以下内容:
"error: no matching function for call to 'TiXmlElement::TiXmlElement(std::_cxx11::string&)" 这是在 c++ 上使用 wxwidgets,使用 tinyxml 背后的想法是能够存储数组并在之后重用它们。
解决了这个问题:我不得不进入 tinyxml.h 并在顶部添加这个:#define TIXML_USE_STL
string/char类型有两个构造函数如下:
TiXmlElement::TiXmlElement (const char * _value)
或
#ifdef TIXML_USE_STL
TiXmlElement::TiXmlElement( const std::string& _value )
所以你必须定义 TIXML_USE_STL 如果你想使用 std::string
否则使用 const char *
参考tinyxml.cpp
如前所述,没有与 TiXmlElement(std::_cxx11::string&)
匹配的函数,据我所知,它是来自 c11 标准化的一些字符串 class。在这种情况下,它将恰好是 point
字符串。尝试检查是否有一种方法可以使用 TiXmlElement 的字符串,正如错误所说,你提供了一个错误的实例 class std::_cxx11::string&