I am getting this getting this error that " QTNetwork , No such file or Directory"

I took this code dierctly from fortune example, created a new project.
can anyone explain what went wrong

Qt Code:
  1. #include <QtGui>
  2. #include <QtNetwork>
  3.  
  4. #include <stdlib.h>
  5.  
  6. #include "server.h"
  7.  
  8. server::server(QWidget *parent)
  9. : QDialog(parent), tcpServer(0), networkSession(0)
  10. {
  11. statusLabel = new QLabel;
  12. quitButton = new QPushButton(tr("Quit"));
  13. quitButton->setAutoDefault(false);
  14.  
  15.  
  16. QNetworkConfigurationManager manager;
  17. if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
  18. // Get saved network configuration
  19. QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
  20. settings.beginGroup(QLatin1String("QtNetwork"));
  21. const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
  22. settings.endGroup();
  23.  
  24. // If the saved network configuration is not currently discovered use the system default
  25. QNetworkConfiguration config = manager.configurationFromIdentifier(id);
  26. if ((config.state() & QNetworkConfiguration::Discovered) !=
  27. QNetworkConfiguration::Discovered) {
  28. config = manager.defaultConfiguration();
  29. }
  30.  
  31. networkSession = new QNetworkSession(config, this);
  32. connect(networkSession, SIGNAL(opened()), this, SLOT(sessionOpened()));
  33.  
  34. statusLabel->setText(tr("Opening network session."));
  35. networkSession->open();
  36. } else {
  37. sessionOpened();
  38. }
  39.  
  40. //! [2]
  41. fortunes << tr("You've been leading a dog's life. Stay off the furniture.")
  42. << tr("You've got to think about tomorrow.")
  43. << tr("You will be surprised by a loud noise.")
  44. << tr("You will feel hungry again in another hour.")
  45. << tr("You might have mail.")
  46. << tr("You cannot kill time without injuring eternity.")
  47. << tr("Computers are not intelligent. They only think they are.");
  48. //! [2]
  49.  
  50. connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));
  51. //! [3]
  52. connect(tcpServer, SIGNAL(newConnection()), this, SLOT(sendFortune()));
  53. //! [3]
  54.  
  55. QHBoxLayout *buttonLayout = new QHBoxLayout;
  56. buttonLayout->addStretch(1);
  57. buttonLayout->addWidget(quitButton);
  58. buttonLayout->addStretch(1);
  59.  
  60. QVBoxLayout *mainLayout = new QVBoxLayout;
  61. mainLayout->addWidget(statusLabel);
  62. mainLayout->addLayout(buttonLayout);
  63. setLayout(mainLayout);
  64.  
  65. setWindowTitle(tr("Fortune Server"));
  66. }
To copy to clipboard, switch view to plain text mode 



Header is:::


Qt Code:
  1. #ifndef SERVER_H
  2. #define SERVER_H
  3.  
  4. #include <QDialog>
  5. QT_BEGIN_NAMESPACE
  6. class QLabel;
  7. class QTcpServer;
  8. class QNetworkSession;
  9. QT_END_NAMESPACE
  10.  
  11.  
  12. class server : public QDialog
  13. {
  14. Q_OBJECT
  15.  
  16. public:
  17. server(QWidget *parent = 0);
  18.  
  19.  
  20. private:
  21. void sessionOpened();
  22. void sendFortune();
  23. QLabel *statusLabel;
  24. QPushButton *quitButton;
  25. QTcpServer *tcpServer;
  26. QStringList fortunes;
  27. QNetworkSession *networkSession;
  28.  
  29. };
  30.  
  31. #endif // SERVER_H
To copy to clipboard, switch view to plain text mode