Results 1 to 9 of 9

Thread: Problem with connect

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2011
    Posts
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4

    Default Re: Problem with connect

    The Q_OBJECT macro is missing in your header file

  2. #2
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Problem with connect

    Quote Originally Posted by nosleduc View Post
    The Q_OBJECT macro is missing in your header file
    Umm, I heard about that earlier. But where am I supposed to put this in the header file? All places where I try, new problems with the compiler arises. For example, if I put it exactly in line 19, the following error appears:

    /home/martin/Documentos/Programas Qt/Servidor 3.4.3/menuwindows.cpp:6: error: undefined reference to `vtable for MenuWindows'
    /home/martin/Documentos/Programas Qt/Servidor 3.4.3/menuwindows.cpp:6: error: undefined reference to `vtable for MenuWindows'

    And how exaclty should I put it?

  3. #3
    Join Date
    Jul 2011
    Posts
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4

    Default Re: Problem with connect

    Qt Code:
    1. class MenuWindows : public QObject
    2. {
    3. Q_OBJECT
    4. public:
    5. ...
    6. }
    To copy to clipboard, switch view to plain text mode 

    if you are using qtcreator you can just recompile but if you are using a different IDE you need to use again qmake on your .pro file it depends on the IDE you are using

  4. #4
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Problem with connect

    Well, I'm using Qt creator and I put the macro exactly in the place you (and the Help) indicates, but the problem persists. Here is the complete description of the problem:

    moc_mytask.o moc_myserver.o moc_myclient.o -L/home/martin/QtSDK/Desktop/Qt/473/gcc/lib -L/usr/local/lib -lqwt-qt4 -lQtSvg -lQtGui -lQtNetwork -lQtCore -lpthread
    menuwindows.o: In function `MenuWindows':
    make: Saindo do diretório `/home/martin/Documentos/Programas Qt/Servidor 3.4.3'
    /home/martin/Documentos/Programas Qt/Servidor 3.4.3/menuwindows.cpp:6: undefined reference to `vtable for MenuWindows'
    /home/martin/Documentos/Programas Qt/Servidor 3.4.3/menuwindows.cpp:6: undefined reference to `vtable for MenuWindows'
    collect2: ld returned 1 exit status
    make: ** [Servidor] Erro 1
    The process "/usr/bin/make" exited with code 2.
    Error while building project Servidor (target: )
    When executing build step 'Make'

    It points to the cpp file.

  5. #5
    Join Date
    Jul 2011
    Posts
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4

    Default Re: Problem with connect

    In the build menu
    1) Clean All
    2) Run qmake
    3) Rebuild all

  6. #6
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Problem with connect

    Oh! Finally!

    Thanks!

Similar Threads

  1. Problem with connect
    By eekhoorn12 in forum Newbie
    Replies: 3
    Last Post: 21st December 2010, 20:48
  2. connect() problem
    By harmodrew in forum Newbie
    Replies: 14
    Last Post: 5th August 2010, 17:45
  3. Connect Problem
    By nrabara in forum Newbie
    Replies: 3
    Last Post: 4th May 2009, 12:19
  4. connect problem
    By liengen in forum Newbie
    Replies: 2
    Last Post: 22nd October 2008, 16:21
  5. Problem with connect()
    By mrnor3 in forum Qt Programming
    Replies: 3
    Last Post: 23rd July 2008, 14:05

Tags for this Thread

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.