Results 1 to 4 of 4

Thread: function call

  1. #1
    Join Date
    Mar 2007
    Location
    Vienna / Austria
    Posts
    54
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default function call

    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:

    Qt Code:
    1. undefined reference to `ClientSocket::myDecodeTcpMsg(unsigned long, unsigned char*)'
    2.  
    3. *** Exited with status: 2 ***
    To copy to clipboard, switch view to plain text mode 

    Here are some fragments of my Source Code:

    Qt Code:
    1. void ClientSocket::readRequest()
    2. {
    3. char TcpBuffer[1500];
    4. qint64 Size;
    5. qint64 result_code;
    6. dword dwMsgLength;
    7.  
    8. Size = bytesAvailable();
    9. result_code = read ((char *) TcpBuffer, Size);
    10.  
    11. dwMsgLength = Size;
    12.  
    13. myDecodeTcpMsg (dwMsgLength, (unsigned char *) TcpBuffer);
    14. }
    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(...)

    Qt Code:
    1. 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

    Qt Code:
    1. class ClientSocket : public QTcpSocket
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. ClientSocket(QObject *parent = 0);
    7.  
    8. void myDecodeTcpMsg(dword dwLength, byte* pbData);
    9.  
    10. signals:
    11. void sendResponseSignal();
    12.  
    13. private slots:
    14. void readRequest();
    15.  
    16. private:
    17. quint16 nextBlockSize;
    18. };
    To copy to clipboard, switch view to plain text mode 

    The Headerfile looks like this!
    Last edited by Walsi; 12th June 2007 at 08:57.

  2. #2
    Join Date
    May 2006
    Location
    Germany
    Posts
    108
    Thanks
    2
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: function call

    I cannot see any implementation of a function called myDecodeTcpMsg, maybe you wanted to use myDecodeTcpControlMsg()?
    "If you lie to the compiler, it will get its revenge." - Henry Spencer

  3. #3
    Join Date
    Mar 2007
    Location
    Vienna / Austria
    Posts
    54
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: function call

    Yes that is my mistake!!!

    Sorry

    I already edited the last thread!

  4. #4
    Join Date
    Mar 2007
    Location
    Vienna / Austria
    Posts
    54
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: function call

    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.

    Qt Code:
    1. void ClientSocket::myDecodeTcpControlMsg (dword dwLength, byte* pbData)
    2. {
    3. ....
    4. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Cannot call function without object
    By Salazaar in forum Newbie
    Replies: 5
    Last Post: 11th June 2007, 14:55
  2. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  3. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12:52
  4. I got two problems when I used static compiled library of QT4
    By qintm in forum Installation and Deployment
    Replies: 8
    Last Post: 20th April 2006, 08:52
  5. virtual overloaded functions and base class function call...
    By nouknouk in forum General Programming
    Replies: 7
    Last Post: 11th March 2006, 21:26

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.