Skip to content

error: no viable conversion from returned value of type 'int' to function return type 'QString' #4

@w5688414

Description

@w5688414

my QT version is 5.9.7,
mac os system
error occurs when I compile:
sml/smlworkbook.cpp:40:12: error: no viable conversion from returned value of type 'int' to function return type 'QString' return bookViews_raw[0][attribute].toInt(); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:219:5: note: candidate constructor not viable: no known conversion from 'int' to 'QChar' for 1st argument QString(QChar c); ^ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:228:12: note: candidate constructor not viable: no known conversion from 'int' to 'QString &&' for 1st argument inline QString(QString && other) Q_DECL_NOTHROW : d(other.d) { other.d ... ^ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:658:31: note: candidate constructor not viable: no known conversion from 'int' to 'const char *' for 1st argument inline QT_ASCII_CAST_WARN QString(const char *ch) ^ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:661:31: note: candidate constructor not viable: no known conversion from 'int' to 'const QByteArray &' for 1st argument inline QT_ASCII_CAST_WARN QString(const QByteArray &a) ^ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:777:12: note: candidate constructor not viable: no known conversion from 'int' to 'const QString::Null &' for 1st argument inline QString(const Null &): d(Data::sharedNull()) {} ^ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:787:29: note: candidate constructor not viable: no known conversion from 'int' to 'QStringDataPtr' for 1st argument Q_DECL_CONSTEXPR inline QString(QStringDataPtr dd) : d(dd.ptr) {} ^ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:880:17: note: candidate constructor not viable: no known conversion from 'int' to 'QLatin1String' for 1st argument inline QString::QString(QLatin1String aLatin1) : d(fromLatin1_helper(aLatin1... ^ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:906:17: note: candidate constructor not viable: no known conversion from 'int' to 'const QString &' for 1st argument inline QString::QString(const QString &other) Q_DECL_NOTHROW : d(other.d) ^ sml/smlworkbook.cpp:40:12: error: no viable conversion from returned value of type 'int' to function return type 'QString' return bookViews_raw[0][attribute].toInt(); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:219:5: note: candidate constructor not viable: no known conversion from 'int' to 'QChar' for 1st argument QString(QChar c); ^ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:228:12: note: candidate constructor not viable: no known conversion from 'int' to 'QString &&' for 1st argument inline QString(QString && other) Q_DECL_NOTHROW : d(other.d) { other.d ... ^ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:658:31: note: candidate constructor not viable: no known conversion from 'int' to 'const char *' for 1st argument inline QT_ASCII_CAST_WARN QString(const char *ch) ^ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:661:31: note: candidate constructor not viable: no known conversion from 'int' to 'const QByteArray &' for 1st argument inline QT_ASCII_CAST_WARN QString(const QByteArray &a) ^ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:777:12: note: candidate constructor not viable: no known conversion from 'int' to 'const QString::Null &' for 1st argument inline QString(const Null &): d(Data::sharedNull()) {} ^ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:787:29: note: candidate constructor not viable: no known conversion from 'int' to 'QStringDataPtr' for 1st argument Q_DECL_CONSTEXPR inline QString(QStringDataPtr dd) : d(dd.ptr) {} ^ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:880:17: note: candidate constructor not viable: no known conversion from 'int' to 'QLatin1String' for 1st argument inline QString::QString(QLatin1String aLatin1) : d(fromLatin1_helper(aLatin1... ^ /Users/eric/Qt5.9.7/5.9.7/clang_64/lib/QtCore.framework/Headers/qstring.h:906:17: note: candidate constructor not viable: no known conversion from 'int' to 'const QString &' for 1st argument inline QString::QString(const QString &other) Q_DECL_NOTHROW : d(other.d) ^ 1 error generated. make[3]: *** [.obj/debug/smlworkbook.o] Error 1 make[3]: *** Waiting for unfinished jobs....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions