PDA

View Full Version : function call



Walsi
12th June 2007, 08:14
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 ***


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);
}

Here is the slot function readRequest in which I want to call the function myDecodeTcpMsg(...)


connect(this, SIGNAL(readyRead()), this, SLOT(readRequest()));

Here is the Signal & Slot connection which "enables" the readRequest() function


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;
};

The Headerfile looks like this!

Methedrine
12th June 2007, 08:51
I cannot see any implementation of a function called myDecodeTcpMsg, maybe you wanted to use myDecodeTcpControlMsg()?

Walsi
12th June 2007, 08:57
Yes that is my mistake!!!

Sorry

I already edited the last thread!

Walsi
12th June 2007, 09:13
I think a solve the problem for myself:

the Linker doesn't find the implementation of the called function.
And that is the reason why it stops the linking process.



void ClientSocket::myDecodeTcpControlMsg (dword dwLength, byte* pbData)
{
....
}