Reputation: 115
I have an application that was written on an Ubuntu desktop system in Qt Creator and I want to compile it on another system (Ubuntu server). This server has no GUI so compilation has to be done through CLI. Upon issuing the make command it begins compiling but throws a compiler error saying:
error: ‘fromStdString’ is not a member of ‘QByteArray’ QByteArray myData = QByteArray::fromStdString(data);
The exact same code works just find on another system and compiles fine. What should I do to fix this problem? Is it an issue with installed libraries on the system or something else?
Upvotes: 1
Views: 1163
Reputation: 2792
In Qt4, QString::fromStdString() requires Qt to be compiled with STL support, so this may be your problem.
From Qt Docs:
This constructor is only available if Qt is configured with STL compatibility enabled.
However, if you're using QByteArray, refer to @iksemyonov's answer
Upvotes: 1
Reputation: 4196
I think the issue is this one, to quote http://doc.qt.io/qt-5/qbytearray.html#fromStdString:
This function was introduced in Qt 5.4.
That is, if you're using Qt5, in Qt4 there is no such member function indeed.
Upvotes: 5