سؤال

When compiling kdepimlibs on windows using msvc 2010 I get the following error

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 *)'

(I have trimmed out some suggestions as irrelevant)

the code this is failing on is...

#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;
    }
  }

I cannot find the correct comparison operator. Where should I be looking? Was it introduced in a later qt?

هل كانت مفيدة؟

المحلول 2

The problem was resolved

It seems to apply to compiling kdepimlibs with msvc2010 (mingw is ok but fails else where)

The problem is QT_NO_CAST_FROM_ASCII is defined.

There was a patch that was meant for the 4.10.2 tag of the 4.10 branch but it never seemed to have been added to the repository

The patch can be found here https://bugs.kde.org/attachment.cgi?id=79049

Apply the patch to the KDE/4.10 branch and it will compile

نصائح أخرى

Kevin Funk seems to have fixed the issue in upstream:

Make compile on MSVC2010

Please make sure you have this patch distributed on your machine.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top