QNetworkAccessManager crashes outside Qt Creator
-
I migth be doing something fundamentally wrong here, but my approach is in line with the examples that I've managed to find online. It seems that calling the QNetworkAccessManager constructor crashes my program with an undefined "runtime error" in Windows 8.1. I've successfully used it inside Qt Creator, but as soon as I try to use it as a stand-alone program it crashes.
Even this very minimal code replicates the problem (simply a form with a button). The program crashes immidiately when I click the pushButton, _only _ if I run the program outside Qt Creator.
mainwindow.h
@#ifndef MAINWINDOW_H
#define MAINWINDOW_H#include <QMainWindow>
#include "QtNetwork"
#include "QtNetwork/QNetworkAccessManager"
#include "QtNetwork/QNetworkReply"namespace Ui {
class MainWindow;
}class MainWindow : public QMainWindow
{
Q_OBJECTpublic:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();private slots:
void on_pushButton_clicked();private:
Ui::MainWindow *ui;
QNetworkAccessManager *grabber;
};#endif // MAINWINDOW_H@
mainwindow.cpp
@#include "mainwindow.h"
#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}MainWindow::~MainWindow()
{
delete ui;
}void MainWindow::on_pushButton_clicked()
{
grabber = new QNetworkAccessManager(this);
}@Am I doing something wrong here? It doesn't seem like there's a lot of room for mistakes...
-
Hi,
The codes looks good.
Did you deploy the bearer plugin with your application ?
-
Sure, "here":http://qt-project.org/wiki/Deploy_an_Application_on_Windows is a fine wiki entry about Windows application deployment. The bearer plugins are in the bearer sub-directory