Results 1 to 7 of 7

Thread: SIGNALS error....what's wrong?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Posts
    172
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    30
    Thanked 2 Times in 2 Posts

    Angry SIGNALS error....what's wrong?

    This is the error I got after running the following commands:

    qmake -project
    qmake
    make
    moc_desktop.o: In function `MyDesktop:: progs_Clicked()':
    /home/nupul/trials/2desktop/moc_desktop.cpp:93: multiple definition of
    `MyDesktop:: progs_Clicked()'
    desktop.o:/home/nupul/trials/2desktop/desktop.cpp:94: first defined here
    /usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: Warning: size of symbol `MyDesktop:: progs_Clicked()' changed from 24 in desktop.o to 29 in moc_desktop.o
    moc_desktop.o: In function `MyDesktop:: docs_Clicked()':
    /home/nupul/trials/2desktop/moc_desktop.cpp:87: multiple definition of
    `MyDesktop:: docs_Clicked()'
    desktop.o:/home/nupul/trials/2desktop/desktop.cpp:87: first defined here
    /usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: Warning: size of symbol `MyDesktop:: docs_Clicked()' changed from 24 in desktop.o to 29 in moc_desktop.o
    moc_desktop.o: In function `MyDesktop::mycomp_Clicked()':
    /home/nupul/trials/2desktop/moc_desktop.cpp:81: multiple definition of `MyDesktop::mycomp_Clicked()'
    desktop.o:/home/nupul/trials/2desktop/desktop.cpp:80: first defined here
    /usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: Warning: size of symbol `MyDesktop::mycomp_Clicked()' changed from 24 in desktop.o to 29 in moc_desktop.o
    collect2: ld returned 1 exit status
    make: *** [2desktop] Error 1
    here is my header file format...

    Qt Code:
    1. class MyDesktop : public QWidget
    2. {
    3. Q_OBJECT
    4.  
    5.  
    6. private:
    7.  
    8. QPushButton *mycomp;
    9. QPushButton *docs;
    10. QPushButton *progs;
    11. QPushButton *trash;
    12.  
    13. QBrush brush;
    14. QPalette pal;
    15.  
    16. void getBackground();
    17. void createButtons();
    18. public:
    19.  
    20. MyDesktop();
    21.  
    22.  
    23. signals:
    24. void showMyComputerMenu();
    25.  
    26. protected:
    27. void resizeEvent(QResizeEvent *event);
    28.  
    29. };
    30.  
    31. #endif
    To copy to clipboard, switch view to plain text mode 

    This is my constructor

    Qt Code:
    1. MyDesktop::MyDesktop():QWidget(0)
    2. {
    3.  
    4. setGeometry(100,100,400,400);
    5. setWindowTitle("My Desktop");
    6.  
    7. getBackground();
    8.  
    9. createButtons();
    10.  
    11. connect(mycomp,SIGNAL(clicked()),this,SLOT(showMyComputerMenu()));
    12. }
    To copy to clipboard, switch view to plain text mode 

    and this is the signal

    Qt Code:
    1. void MyDesktop::showMyComputerMenu()
    2. {
    3.  
    4. qDebug("My computer signal activate");
    5.  
    6. }
    To copy to clipboard, switch view to plain text mode 

    Now the thing is this...if i change my signal: showMyComputerMenu to a slot, and run the aforementioned command sequence,
    it works fine! No errors pop-up. I read through the docs, and it said qmake can take care of all the signals/slots etc. I have a feeling that I am missing out something...like running moc, But I am not able to understand at all what am I exactly supposed to do???



    Thanks

    Nupul.
    Last edited by nupul; 5th May 2006 at 08:46.

Similar Threads

  1. Signals are delayed on X11?
    By Cruz in forum Qt Programming
    Replies: 13
    Last Post: 18th February 2009, 12:59

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.