Results 1 to 5 of 5

Thread: Strange compilation errors when using "invokeMethod"

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,233
    Thanks
    303
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Strange compilation errors when using "invokeMethod"

    You have included the Q_OBJECT macro in the declaration of class ClientRunnable, but the base class QRunnable is not derived from QObject. Therefore, all of the meta-object boilerplate that the Q_OBJECT macro inserts (and which the moc compiler looks for) can't be compiled because the required QObject base class code to support it isn't there.

    If you need support for signals and slots in ClientRunnable (I don't see that you do), then you can derive it from both QObject and QRunnable. If you don't, then remove the Q_OBJECT macro, delete the moc_ClientRunnable.* files, and re-run qmake (if you are using Qt Creator) or a rebuild all if you are using Visual Studio.
    Last edited by d_stranz; 8th December 2021 at 16:18.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  2. The following user says thank you to d_stranz for this useful post:

    jcbaraza (8th December 2021)

  3. #2
    Join Date
    Jun 2012
    Location
    Spain
    Posts
    19
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Strange compilation errors when using "invokeMethod"

    Yes! Just another silly mistake. Most of my classes haven't the Q_OBJECT macro, so I don't know why I put it there...

    Thanks a lot!
    Last edited by jcbaraza; 8th December 2021 at 21:02.

Similar Threads

  1. Replies: 1
    Last Post: 20th November 2015, 10:02
  2. Replies: 3
    Last Post: 16th March 2015, 07:31
  3. qt cross compilation error "unable to load interpreter"
    By cpalm in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 12th July 2011, 10:51
  4. Replies: 4
    Last Post: 26th July 2010, 07:02
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.