Results 1 to 9 of 9

Thread: Undefined reference to signal

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2012
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Undefined reference to signal

    Hi all,
    I have a problem that could be very stupid, but I'm not able to solve it.
    I'm tring to be aware when an operator click with mouse on a qwtPlot, and have a class informed with a signal of the mouse position on the plot where he clicked.

    These are the pieces of code.
    Header:
    Qt Code:
    1. #include <QMouseEvent>
    2. #include <QDebug>
    3. #include <qwt_plot.h>
    4.  
    5. class QwtPlotMy : public QwtPlot
    6. {
    7. public:
    8. QwtPlotMy(int idPlotValue = 0);
    9.  
    10. signals:
    11. void clickSignal();
    12.  
    13. private:
    14. void mousePressEvent(QMouseEvent * event);
    15.  
    16. int idPlot;
    17. };
    To copy to clipboard, switch view to plain text mode 
    Cpp:
    Qt Code:
    1. #include "qwtplotmy.h"
    2.  
    3. QwtPlotMy::QwtPlotMy(int idPlotValue) :
    4. {
    5. idPlot = idPlotValue;
    6.  
    7. return;
    8. }
    9.  
    10. void QwtPlotMy::mousePressEvent(QMouseEvent * event)
    11. {
    12. emit (clickSignal());
    13. qDebug() << "Into qwtplot"<<idPlot;
    14. qDebug() << "x"<< event->x() << " - y"<< event->y() ;
    15. return;
    16. }
    To copy to clipboard, switch view to plain text mode 
    The problem is: compiling I get the message error:
    Qt Code:
    1. undefined reference to 'QwtPlotMy::clickSignal()'
    To copy to clipboard, switch view to plain text mode 

    If I comment the "emit (clickSignal())" line everything works well and I have the mouse position in the debug messages. Where I missed something?

    Thank you very much in advance,
    Carlo
    Last edited by chinalski; 26th July 2012 at 16:33.

Similar Threads

  1. Undefined reference to my signal
    By tomek in forum Newbie
    Replies: 9
    Last Post: 1st December 2011, 07:14
  2. undefined reference
    By deepakswaroop in forum Newbie
    Replies: 1
    Last Post: 2nd March 2011, 06:46
  3. Undefined reference
    By eekhoorn12 in forum Qt Programming
    Replies: 2
    Last Post: 6th January 2011, 15:45
  4. undefined reference
    By jayreddy in forum Qt Programming
    Replies: 1
    Last Post: 20th November 2009, 13:45
  5. Undefined Reference To...
    By ManuMies in forum Qt Programming
    Replies: 6
    Last Post: 10th February 2009, 12:14

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
  •  
Qt is a trademark of The Qt Company.