0

Eventhough, I put 'network' in .pro file,

My Qt creator cannot find QTcpSocket and QTcpServer.

What should I do?

I remove the Qtcreator and redownloaded already but it also did not work.

My Linux version is Ubuntu 14.04 LTS

and I downloaded QT Creator by linux commands.

sudo apt-get install qtcreator

I even do the linus updates because I worried that I missed something.

sudo get-apt update sudo get-apt upgrade

Why Qtcreator cannot perceive QTcpServer and QTcpSocket headers?

--------------*.pro -----------------------------------

QT       += core gui network

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = server11
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

-------------------mainwindow.h--------------------------------------

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTcpSocket>
#include <QTcpServer>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H

Ray
  • 53
  • 1
  • 7
  • Did you try #include ? Meybe you need to install full Qt, not only QtCreator? – Yaroslav Jun 21 '15 at 14:55
  • But what it exactly means full Qt? – Ray Jun 21 '15 at 15:06
  • 1
    Wow!! is working!!!! Really, Thank you! I spent about 3hours to fix this problem. Thank you!! – Ray Jun 21 '15 at 15:07
  • 2
    That's a non-solution. `#include ` *must* work as-is, if it's not working there's something else missing. – peppe Jun 21 '15 at 17:22
  • Oh, really? I do not know what is missing... – Ray Jun 22 '15 at 08:42
  • 1
    After you change the contents of the `.pro` file, you **must** right-click on the topmost project node in the Creator's project explorer and select "Run qmake". That would have fixed the problem. The style of includes is from Qt 4 and is deprecated in Qt 5. They simply mask trivial problems like yours. Alternatively, you could delete the shadow build folder. – Kuba hasn't forgotten Monica Jun 22 '15 at 20:28

1 Answers1

1

Did you install the complete framework? Or just the IDE?

Try downloading the Qt offline installer and downloading the framework through it. Download and install it from here.

Qt Open Source

Instructions for Ubuntu