[Solved] error: ‘QStringLiteral’ was not declared in this scope

The following problem occurs with QT compilation:

error: ‘QStringLiteral’ was not declared in this scope
resmodel->setHorizontalHeaderLabels(QStringList()<<QStringLiteral(Name)<<QStringLiteral(Size));
^
QMetaObject::Connection connRet = QObject::connect(naManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*)));
error: ‘connRet’ was not declared in this scope
Q_ASSERT(connRet);
^
/usr/include/qt4/QtCore/qglobal.h:1940:32: note: in definition of macro ‘Q_ASSERT’
define Q_ASSERT(cond) ((!(cond)) ?qt_assert(#cond,FILE,LINE) : qt_noop())
error: ‘class QComboBox’ has no member named ‘setCurrentText’; did you mean ‘setCurrentIndex’?
CombBox->setCurrentText(curX);

There is a situation that is caused by using QT4 to compile code written in QT5 environment, some operating systems have both QT4, QT5, just switch to QT5 is fine
QT Creator “Tools” —- “Options” —- “build&run” – “Build Kit ( kit)”-“qt version” select QT5 on it

Read More: