使用msvc 2010在Windows上编译kdepimlibs时出现以下错误
q:\kdepimlibs\akonadi\notes\noteutils.cpp(212) : error C2678: binary '==' : no operator found which takes a left-hand operand of type 'const QString' (or there is no acceptable conversion)
could be 'built-in C++ operator==(const char [8], const char [8])'
r:\include\QtCore/qchar.h(392): or 'bool operator ==(QChar,QChar)'
r:\include\QtCore/qstring.h(908): or 'bool operator ==(QString::Null,QString::Null)'
r:\include\QtCore/qstring.h(909): or 'bool operator ==(QString::Null,const QString &)'
r:\include\QtCore/qstring.h(910): or 'bool operator ==(const QString &,QString::Null)'
r:\include\QtCore/qstring.h(1202): or 'bool operator ==(const QStringRef &,const QStringRef &)'
r:\include\QtCore/qstring.h(1205): or 'bool operator ==(const QString &,const QStringRef &)'
r:\include\QtCore/qstring.h(1208): or 'bool operator ==(const QStringRef &,const QString &)'
r:\include\QtCore/qstring.h(1212): or 'bool operator ==(const QLatin1String &,const QStringRef &)'
r:\include\QtCore/qstring.h(1215): or 'bool operator ==(const QStringRef &,const QLatin1String &)'
r:\include\QtCore/qstring.h(1236): or 'bool operator ==(const char *,const QStringRef &)'
r:\include\QtCore/qstring.h(1238): or 'bool operator ==(const QStringRef &,const char *)'
(我已经删除了一些不相关的建议)
失败的代码是......
#define CLASSIFICATION_PRIVATE "Private"
#define CLASSIFICATION_CONFIDENTIAL "Confidential"
if (KMime::Headers::Base *classificationHeader = msg->headerByType(X_NOTES_CLASSIFICATION_HEADER)) {
const QString &c = classificationHeader->asUnicodeString();
if ( c == CLASSIFICATION_PRIVATE ) { **<== HERE**
classification = Private;
} else if ( c == CLASSIFICATION_CONFIDENTIAL ) { **<== ALSO HERE**
classification = Confidential;
}
}
我找不到正确的比较运算符。我应该在哪里看? 它是在后来的qt中引入的吗?
答案 0 :(得分:0)
答案 1 :(得分:0)
问题已解决
它似乎适用于使用msvc2010编译kdepimlibs(mingw没问题,但在其他地方失败)
问题是定义了QT_NO_CAST_FROM_ASCII。
有一个补丁适用于4.10分支的4.10.2标记,但它似乎从未添加到存储库
可在此处找到此修补程序https://bugs.kde.org/attachment.cgi?id=79049
将补丁应用到KDE / 4.10分支,它将编译