当在vs中遇到不存在从QString到const char *的适合转换函数这样的错误时,有两种方式解决,如下:
#include <QtCore/QCoreApplication>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QString hello("Hello World");
const char *chHello = hello.toLocal8Bit().data();
const char *chHelloUft8 = hello.toUtf8().constData();
qDebug() << chHello << "\n";
qDebug() << chHelloUft8 << "\n";
return a.exec();
}