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);
}上面是我正在尝试的示例代码,我的问题是它告诉我以下内容:
“错误:没有匹配的函数来调用'TiXmlElement::TiXmlElement(std::_cxx11::string&)”这是在c++上使用wxwidgets,使用tinyxml背后的想法是能够存储数组并在以后重用它们。
解决了这个问题:我不得不进入tinyxml.h并在顶部添加以下内容:#define TIXML_USE_STL
发布于 2020-02-19 17:02:07
string/char类型有两个构造函数,如下所示:
TiXmlElement::TiXmlElement (const char * _value)或
#ifdef TIXML_USE_STL
TiXmlElement::TiXmlElement( const std::string& _value ) 因此,如果您想要使用std::string,则必须定义TIXML_USE_STL,否则必须使用const char *
请参阅tinyxml.cpp
发布于 2020-02-19 17:02:38
如上所述,没有与TiXmlElement(std::_cxx11::string&)匹配的函数,据我正确理解,它是c11标准化中的某个字符串类。在这种情况下,它将完全是point字符串。尝试检查是否有一种方法可以使用用于TiXmlElement的字符串,很明显,正如错误所说的那样,您提供的是错误类std::_cxx11::string&的实例
https://stackoverflow.com/questions/60296324
复制相似问题