Linkage problems: LNK2001 QMetaObject
-
I'm coding a single class and inserting a single slot in that. In this class, I'm inheriting from QObject to use QObject::connect.
When compiling QtCreator complains about linkage:@
MakeConn.obj:-1: error: LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall MakeConn::metaObject(void)const " (?metaObject@MakeConn@@UBEPBUQMetaObject@@XZ)MakeConn.obj:-1: error: LNK2001: unresolved external symbol "public: virtual void * __thiscall MakeConn::qt_metacast(char const *)" (?qt_metacast@MakeConn@@UAEPAXPBD@Z)
MakeConn.obj:-1: error: LNK2001: unresolved external symbol "public: virtual int __thiscall MakeConn::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@MakeConn@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
@I've read this link about moc: http://doc.qt.digia.com/4.7-snapshot/moc.html
But it isn't applicable for make files only?
Wht do I need to do to solve this constructor errors?My environment:
Qt SDK4.8.1 in a windows environment.Below the declaration of my class:
@
#include <QList>
#include <QString>
#include <QNetworkAccessManager>
#include <QObject>class MakeConn : public QObject
{
Q_OBJECTpublic:
MakeConn(QObject* parent = 0);
~MakeConn();
void addLayerName(const QString& layerName);
void removeLayerName(const QString& layerName);
...
private:
QList<QString>layerNames;
QString ipAddress, port;
int width, height;
QNetworkAccessManager* networkManager;
QByteArray dataArray;signals:
private slots:
void finishedDownload();
};@ -
If you are using .pro file - do you have such information
@
HEADERS += MakeConn .h
@ -
Hi guziemic. MakeConn is the last one. I found out the solution. I declared this file before the main window and works.
Thanks for reply.@
QT += core gui networkTARGET = MapReader
TEMPLATE = appSOURCES += main.cpp
mainwindow.cpp
GeoMeasurements.cpp
RasterMap.cpp
MakeConn.cppHEADERS += mainwindow.h
GeoMeasurements.h
RasterMap.h
MakeConn.hFORMS += mainwindow.ui
@ -
Your welcome :) If you could, please mark the post as solved by adding [solved] to title.