我正在使用Qt 5.4.1离线版本,我收到QTcpServer的文件未找到错误。我发布了我的.pro文件,以显示我在那里有+ =网络。如果你知道我为什么会收到这个错误,请告诉我!谢谢!
#-------------------------------------------------
#
# Project created by QtCreator 2015-03-21T22:26:44
#
#-------------------------------------------------
QT += core
QT += network
QT -= gui
TARGET = MultiServer2
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp \
myserver.cpp \
mythread.cpp
HEADERS += \
myserver.h \
mythread.h
// BEGIN SERVER HEADER FILE BELOW
#ifndef MYSERVER_H
#define MYSERVER_H
#include <QTcpServer> // <--- THIS IS WHAT IS NOT BEING FOUND
#include <QDebug>
#include "mythread.h"
class MyServer : public QTcpServer
{
Q_OBJECT
public:
explicit MyServer(QObject *parent = 0);
~MyServer();
void startServer();
signals:
public slots:
protected:
void incomingConnection(int socketDescriptor);
};
#endif // MYSERVER_H
答案 0 :(得分:2)
如果.pro文件中有任何更改(如果添加Qt + = network),则需要重新运行qmake
构建 - &gt;运行qmake。