In a slot function of a class a want to call another function of this class.
When I do this, I got following exception at the linking process:
undefined reference to `ClientSocket::myDecodeTcpMsg(unsigned long, unsigned char*)'
*** Exited with status: 2 ***
undefined reference to `ClientSocket::myDecodeTcpMsg(unsigned long, unsigned char*)'
*** Exited with status: 2 ***
To copy to clipboard, switch view to plain text mode
Here are some fragments of my Source Code:
void ClientSocket::readRequest()
{
char TcpBuffer[1500];
qint64 Size;
qint64 result_code;
dword dwMsgLength;
Size = bytesAvailable();
result_code = read ((char *) TcpBuffer, Size);
dwMsgLength = Size;
myDecodeTcpMsg (dwMsgLength, (unsigned char *) TcpBuffer);
}
void ClientSocket::readRequest()
{
char TcpBuffer[1500];
qint64 Size;
qint64 result_code;
dword dwMsgLength;
Size = bytesAvailable();
result_code = read ((char *) TcpBuffer, Size);
dwMsgLength = Size;
myDecodeTcpMsg (dwMsgLength, (unsigned char *) TcpBuffer);
}
To copy to clipboard, switch view to plain text mode
Here is the slot function readRequest in which I want to call the function myDecodeTcpMsg(...)
connect(this, SIGNAL(readyRead()), this, SLOT(readRequest()));
connect(this, SIGNAL(readyRead()), this, SLOT(readRequest()));
To copy to clipboard, switch view to plain text mode
Here is the Signal & Slot connection which "enables" the readRequest() function
{
Q_OBJECT
public:
void myDecodeTcpMsg(dword dwLength, byte* pbData);
signals:
void sendResponseSignal();
private slots:
void readRequest();
private:
quint16 nextBlockSize;
};
class ClientSocket : public QTcpSocket
{
Q_OBJECT
public:
ClientSocket(QObject *parent = 0);
void myDecodeTcpMsg(dword dwLength, byte* pbData);
signals:
void sendResponseSignal();
private slots:
void readRequest();
private:
quint16 nextBlockSize;
};
To copy to clipboard, switch view to plain text mode
The Headerfile looks like this!
Bookmarks