I am trying to create a class in Qt but when i do i get the error of
symbol(s) not found for architecture x86_64
and i do not understad why this is happening. The compile output is
Undefined symbols for architecture x86_64:
"MyThread::MyThread()", referenced from:
Login::on_pushButton_clicked() in login.o
ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
My code is Pass.h
#ifndef PASS_H
#define PASS_H
#include <QMainWindow>
#include <QSqlQuery>
#include <QThread>
extern int Searching, Account_Type, table;
extern QString query;
extern bool executed;
class Pass
{
public:
Pass();
};
class MyThread : public QThread
{
public:
MyThread();
void run();
};
Pass.cpp
#include "pass.h"
#include <QtCore>
#include <QDebug>
int Searching, Account_Type, table;
QString query;
bool executed;
Pass::Pass()
{
}
void MyThread::run()
{
qDebug() << "Hello World";
}
and login.cpp where the class is being used
if(tries == 10)
{
MyThread mThread;
}
if i comment out MyThread mThread out the program opens fine. How can i fix this issue.