undefined reference on emit function
Unsolved
General and Desktop
-
Hello, I have a proyect with a thread and a listWidget, the problem is when I use emit, the error is: "undefined reference to `hiloDelSocket::datos(QString)'", but I declered it on the header.
void hiloDelSocket::run(){ ZeroMemory(buffer,12); recv(sock,buffer,12,0); const QString a = buffer; emit datos(a); //error }
//header class hiloDelSocket: public QThread { Q_OBJECT //I have to use it because otherwise it gives me other error public: hiloDelSocket(QObject *parent = nullptr); signals: void datos(const QString); //here is declarated protected: void run() override; private: char buffer[12]; SOCKET sock; };
-
Hi,
The usual signature of the such a signal is rather a const reference and not a const object.
-
@JuanNunez I deleted my first response as I did not realised that it was about a signal and one does not have to implement a signal.
Did you try a complete rebuild after adding signal? Delete build folder, run qmake and build.