C++ 包含std字符串库时的qt创建者问题

C++ 包含std字符串库时的qt创建者问题,c++,qt,qt-creator,stdstring,C++,Qt,Qt Creator,Stdstring,我有这个功能。我用libxml2和std::string库创建了它 #ifndef KNIHOVNA_H #define KNIHOVNA_H #include <string> #include <libxml/tree.h> std::string hledaniString(int index,xmlDocPtr sharedString) { std::string Istring; xmlAttrPtr attr; xmlChar *attrValue;

我有这个功能。我用libxml2和std::string库创建了它

#ifndef KNIHOVNA_H
#define KNIHOVNA_H
#include <string>
#include <libxml/tree.h>

std::string hledaniString(int index,xmlDocPtr sharedString)
{
std::string Istring;
xmlAttrPtr attr;

 xmlChar *attrValue;
    xmlNodePtr nodeLevel1 = sharedString->children;
int maxValue;
int aIndex;


attr = xmlHasProp(nodeLevel1, (const xmlChar*)"uniqueCount");
if (attr !=NULL)
    {
        attrValue = xmlGetProp(nodeLevel1, (xmlChar *)"uniqueCount");

    }
    else return "Chybny format souboru. Spatny soubor sharedStrings.xml.";

nodeLevel1 = nodeLevel1->children;

maxValue = atoi((const char *) attrValue);
xmlFree(attrValue);
if (maxValue<=index) return "Chybny format souboru. Spatny soubor sharedStrings.xml.";

for (aIndex = 0;aIndex < index; aIndex++ )
{
nodeLevel1 = nodeLevel1->next;
}
nodeLevel1 = nodeLevel1->children;
attrValue = xmlNodeGetContent(nodeLevel1);
xmlFree(attrValue);
attrValue = xmlNodeGetContent(nodeLevel1);
Istring = (char *) attrValue;
xmlFree(attrValue);
    return Istring;

#endif // KNIHOVNA_H

有人能帮我吗?

您可能在该文件或包含的某些标题中有一些打字错误。你能发布整个文件吗?还是太大了?好的,我重写了我的帖子。你在最后缺少了一个
}
。把它放在那里,再试一次。天哪,谢谢你。如果我必须自己去看的话,我永远也找不到它。当你遇到像这样可笑的错误,指向标准标题的语法错误,那么它可能是一个缺少的
}
或者其他一些小错误。
/usr/include/c++/4.8/string:38: In file included from /usr/include/c++/4.8/string:38:0,
/usr/include/c++/4.8/bits/stl_relops.h:-1: In function 'std::string getString(int, xmlDocPtr)':
/usr/include/c++/4.8/bits/stl_relops.h:67: error: expected '=' before '__attribute__'
/usr/include/c++/4.8/bits/stl_relops.h:67: error: expected identifier before '__attribute__'
/usr/include/c++/4.8/bits/stl_relops.h:67: error: expected ';' before '__attribute__'
/usr/include/c++/4.8/bits/stl_relops.h:67: error: expected primary-expression before '__attribute__'
/usr/include/c++/4.8/bits/stl_relops.h:67: error: expected ';' before '__attribute__'
/home/daffy/qt projektz/revize/main.cpp:15: error: expected '}' at end of input