2013-07-11 26 views
1
TiXmlElement * book = new TiXmlElement("book"); 
    root->LinkEndChild(book); 
    string str1="name"; 
    const string str2=catalog[i].id(); 
    book->SetAttribute(str1,str2); 

我得到這樣的錯誤 [錯誤]用於調用 'TiXmlElement ::的setAttribute(的std :: string &,常量字符串&)' 不匹配函數不能在傳遞的setAttribute串

我需要無論如何設置屬性。

+0

任何你沒有做的原因'TiXmlElement book(「book」);'? – chris

回答

3

你忘了#define TIXML_USE_STL

+0

認真的凱西它幫了我很多。是一個noob,我完全錯過了。 thanx問題可以通過在tinixml.h文件中給出 #define TIXML_USE_STL來解決。 –