Hi,
i am using Qt 5.7
I want to make utilize the other class functions.But I am getting the error
searchctlr.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl utilityCtlr::utilityCtlr(void)" (??0utilityCtlr@@QEAA@XZ) referenced in function "public: void __cdecl SearchCtlr::writeXML(class QString,class QString)" (?writeXML@SearchCtlr@@QEAAXVQString@@0@Z)
Code Snippet:
This utility class for generic operation which is common to whole project. Ex: encryption/decryption etc.,
utility.h
--------
#ifndef UTILITY_H
#define UTILITY_H
#include <QObject>
class utilityCtlr : public QObject
{
public:
utilityCtlr();
void utilEncryption();
};
#endif // UTILITY_H
utility.cpp
-----------
#include "utility.h"
#include <QDebug>
utilityCtlr::utilityCtlr()
{
}
void utilityCtlr::utilEncryption()
{
QString strUserName = name;
}
The class calling the utility:
searchctrl.h
-------------
#ifndef SEARCHCTLR_H
#define SEARCHCTLR_H
#include <QObject>
//#include "search.h"
#include "utility.h"
class SearchCtlr : public QObject
{
Q_OBJECT
public:
explicit SearchCtlr(QObject *parent = 0);
Q_INVOKABLE void doSearch(QString name);
private:
utilityCtlr *m_utilityCtlr;
};
searchctrl.cpp
---------------
#include "searchctlr.h"
#include <QDebug>
#include <QDomDocument>
#include <QFile>
#include <QDir>
#include<QXmlStreamReader>
#include<QXmlStreamWriter>
SearchCtlr::SearchCtlr(QObject *parent)
{
// m_search = new Search();
// qDebug()<<__FILE__<<__LINE__<<__FUNCTION__<<"Searc hCtlr Constructor******";
}
void SearchCtlr::doSearch(QString name)
{
m_utilityCtlr = new utilityCtlr(); //Error appears when this two lines are uncommented.
m_utilityCtlr->utilEncryption(name);
}
#endif // SEARCHCTLR_H
Bookmarks