I am trying to make a basic program with the QNetworkAccessManager but I cannot create an instance of the QNetworkAccessManager class. In my header file I instanitate it but then I get a host of errors (8 of them) in the constructor and destructor functions when look similar to the following:

in function MainWindow:
undefined reference to '_imp__ZN21QNetworkAccessManagerC1EP7QObject' mainwindow.cpp 6

Here is the header file code
Qt Code:
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QMainWindow>
  5. #include <QUrl>
  6. #include <QFile>
  7. #include <QtNetwork/QNetworkAccessManager>
  8. #include <QtNetwork/QtNetwork>
  9.  
  10. namespace Ui {
  11. class MainWindow;
  12. }
  13.  
  14. class MainWindow : public QMainWindow
  15. {
  16. Q_OBJECT
  17.  
  18. public:
  19. explicit MainWindow(QWidget *parent = 0);
  20. ~MainWindow();
  21.  
  22. public slots:
  23. void downloadfile();
  24.  
  25. private:
  26. Ui::MainWindow *ui;
  27. QUrl url;
  28. QNetworkAccessManager manager;
  29. QNetworkReply *reply;
  30. QFile *file;
  31. };
  32.  
  33. #endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 

source code
Qt Code:
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3.  
  4. MainWindow::MainWindow(QWidget *parent) :
  5. QMainWindow(parent),
  6. ui(new Ui::MainWindow)
  7. {
  8. ui->setupUi(this);
  9. }
  10.  
  11. MainWindow::~MainWindow()
  12. {
  13. delete ui;
  14. }
  15.  
  16. void MainWindow::downloadfile(){
  17. url = ui->lineEdit->text();
  18. reply = manager.get(QNetworkRequest(url));
  19. }
To copy to clipboard, switch view to plain text mode 

Thanks for your help in advance