项目场景
VS2015+QT5.9
问题描述
调用QString::fromStdString导致程序崩溃
#include <string>
using namespace std;
#include <qtcore/qstring>
int main() {
string s = "111";
QString ss = QString::fromStdString(s);
return 0;
}
原因分析
Debug模式下引用了Release版本的库(QCore.dll改为QCored.dll)
(更深层原因未知)
解决方案
Debug模式下QT引用库QCored.dll
Release模式下QT引用库QCored.dll