I added a class IcecastServer to my QT-project, added the header-file to the pro file and added some code. Everytime I compile it the following errors occur:
release/icecastserver.o:icecastserver.cpp:(.text+0x39): undefined reference to
_imp___ZN10QTcpServerC1EP7QObject' release/icecastserver.o:icecastserver.cpp:(.text+0x50): undefined reference to
impZN12QHostAddressC1ENS_14SpecialAddressE' release/icecastserver.o:icecastserver.cpp:(.text+0x68): undefined reference to_imp___ZN10QTcpServer6listenERK12QHostAddresst' release/icecastserver.o:icecastserver.cpp:(.text+0x73): undefined reference to
_imp_ZN12QHostAddressD1Ev' release/icecastserver.o:icecastserver.cpp:(.text+0x9d): undefined reference to_imp___ZNK10QTcpServer11errorStringEv' release/icecastserver.o:icecastserver.cpp:(.text+0x3d4): undefined reference to
impZN12QHostAddressD1Ev' release/icecastserver.o:icecastserver.cpp:(.text+0x4bd): undefined reference to_imp___ZN10QTcpServerC1EP7QObject' release / icecastserver.o: icecastserver.cpp :(. text + 0x4d4): undefined ссылка на
_imp _ZN12QHostAddressC1ENS_14SpecialAddressE ' release / icecastserver.o: icecastserver.cpp :(. text + 0x4ec): undefined ссылка на_imp ___ ZN10QTcpServer6listenERK12QHostAddresst ' release / icecastserver.o: icecastserver.cpp :(. text + 0x4f7): undefined ссылка на
imp ZN12QHostAddressD1Ev ' release / icecastserver.o: icecastserver.cpp :(. text + 0x521): undefined ссылка на_imp ___ ZNK10QTcpServer11errorStringEv ' release / icecastserver.o: icecastserver.cpp :(. text + 0x858): undefined ссылка на
_imp _ZN12QHostAddressD1Ev '
Что я делаю не так?
Это заголовочный файл:
#ifndef ICECASTSERVER_H
#define ICECASTSERVER_H
#include <QObject>
QT_BEGIN_NAMESPACE
class QTcpServer;
QT_END_NAMESPACE
class IcecastServer : public QObject
{
Q_OBJECT
public:
explicit IcecastServer(QObject *parent = 0);
signals:
public slots:
private:
QTcpServer *tcpServer;
};
#endif // ICECASTSERVER_H
Это исходный файл:
#include "icecastserver.h"
#include "QDebug"
#include <QtNetwork/QTcpServer>
#include <QtGui>
IcecastServer::IcecastServer(QObject *parent) :
QObject(parent)
{
tcpServer = new QTcpServer(this);
//tcpServer->listen(QHostAddress::Any,8000);
if (!tcpServer->listen()){
QMessageBox::critical(NULL, tr("Fortune Server"), tr("Unable to start the server: %1.").arg(tcpServer->errorString()));
return;
}
}