In the Qt 5.6 and 5.7 compilers, it gives the error shown below; in the 4.8.7 compiler there is no such error. What could be the problem?

error: no matching function for call to 'TaskConfig::clrMail(QStringList&, int&)' str = clrMail(list, i); ^ TaskConfig::TaskConfig(QObject *parent) : QObject(parent) { } QStringList TaskConfig::isMailBase() { QStringList list; QString str; int size = list.size(); for(int i=0; i<size; i++) { str = clrMail(list, i); // ОШИБКА ТУТ list_result << str; } return list_result; } QString TaskConfig::clrMail(QString list, int x) { QString buf = list.at(x); buf.trimmed(); return buf; } #ifndef TASKCONFIG_H #define TASKCONFIG_H #include <QObject> #include <QStringList> #include <QDateTime> class TaskConfig : public QObject { Q_OBJECT public: explicit TaskConfig(QObject *parent = 0); QStringList isMailBase(); signals: public slots: private: QString clrMail(QString, int); }; #endif // TASKCONFIG_H 
  • Are the compiler versions the same? - Vladimir Martyanov

1 answer 1

First, Qt xxx is a version of the library, not a compiler. Secondly, this code cannot work anywhere, since You have a function that takes a QString as the first argument, and you pass a QStringList .

Your function should look like this:

 QString clrMail(QStringList, int); 
  • Sometimes I am amazed at my attentiveness and the firm feeling of confidence that I am right, and this is despite the fact that common sense suggested that the problem is solved by a slight increase in attentiveness. - shaman888