关于qt请求http的一个异常,求解 40
代码如下:一个这样的类,其构造函数中:intmain(intargc,char*argv[]){QApplicationa(argc,argv);Dxt_MapManag...
代码如下:一个这样的类,其构造函数中:
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Dxt_MapManager b;
return a.exec();
}
MapManager::MapManager(QObject *parent)
: QObject(parent)
{
m_netManager = new QNetworkAccessManager(this);
QObject::connect(m_netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onFinished(QNetworkReply*)));
QUrl url("http://www.baidu.com/");
QNetworkRequest re;
re.setUrl(QUrl(url));
//如果我用vs2010编译,下面这句将报一个错,并且不能获得http的返回结果,错误在后面
//如果用qtcreator编,那么能正确运行
QNetworkReply* reply = m_netManager->get(re);
QObject::connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
this, SLOT(slotError(QNetworkReply::NetworkError)));
QObject::connect(reply,SIGNAL(readyRead()),this,SLOT(onReplyReady()));
QObject::connect(reply, SIGNAL(sslErrors(QList<QSslError>)),
this, SLOT(slotSslErrors(QList<QSslError>)));
}
//vs中出现的 错误:Exception at 0x74ddc41f, code: 0x6a6: Invalid RPC server, flags=0x1 (execution cannot be continued) (first chance)
求高人指点~~~vs中为什么会出错呢 展开
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Dxt_MapManager b;
return a.exec();
}
MapManager::MapManager(QObject *parent)
: QObject(parent)
{
m_netManager = new QNetworkAccessManager(this);
QObject::connect(m_netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onFinished(QNetworkReply*)));
QUrl url("http://www.baidu.com/");
QNetworkRequest re;
re.setUrl(QUrl(url));
//如果我用vs2010编译,下面这句将报一个错,并且不能获得http的返回结果,错误在后面
//如果用qtcreator编,那么能正确运行
QNetworkReply* reply = m_netManager->get(re);
QObject::connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
this, SLOT(slotError(QNetworkReply::NetworkError)));
QObject::connect(reply,SIGNAL(readyRead()),this,SLOT(onReplyReady()));
QObject::connect(reply, SIGNAL(sslErrors(QList<QSslError>)),
this, SLOT(slotSslErrors(QList<QSslError>)));
}
//vs中出现的 错误:Exception at 0x74ddc41f, code: 0x6a6: Invalid RPC server, flags=0x1 (execution cannot be continued) (first chance)
求高人指点~~~vs中为什么会出错呢 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询