Results 1 to 12 of 12

Thread: Error message in QThread

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2011
    Posts
    58
    Thanks
    1

    Default Re: Error message in QThread

    Hi.

    I did a clean and rebuild. I also make sure I've Q_Object macro in mythread.
    Now I got the following errors. Before I added Q_Object, I've only the LNK2019 error.
    Also, can you confirm that even for custom signals like the earlier author Rachol replied,
    that I still do not need to provide implementation of the valueChanged function?
    If so, how do I resolve these metaobject error below?

    Please help. I'm losing my hair over this and cant move on.


    Qt Code:
    1. mythread.obj:-1: error: LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall mythread::metaObject(void)const " (?metaObject@mythread@@UBEPBUQMetaObject@@XZ)
    2. mythread.obj:-1: error: LNK2001: unresolved external symbol "public: virtual void * __thiscall mythread::qt_metacast(char const *)" (?qt_metacast@mythread@@UAEPAXPBD@Z)
    3. mythread.obj:-1: error: LNK2001: unresolved external symbol "public: virtual int __thiscall mythread::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@mythread@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
    4. mythread.obj:-1: error: LNK2019: unresolved external symbol "protected: void __thiscall mythread::valueChanged(int)" (?valueChanged@mythread@@IAEXH@Z) referenced in function "public: void __thiscall mythread::init(void)" (?init@mythread@@QAEXXZ)
    5. mythread.obj:-1: error: LNK2001: unresolved external symbol "public: static struct QMetaObject const mythread::staticMetaObject" (?staticMetaObject@mythread@@2UQMetaObject@@B)
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Error message in QThread

    You do not provide implementation of any signals, because moc will do that. You need to implement slots if you have any.
    This looks like moc code is not compiled, how do you build your project ? If you have a .pro file, post it here. Show the header too, maybe you have some obvious errors, typos etc.

  3. #3
    Join Date
    Apr 2011
    Posts
    58
    Thanks
    1

    Default Re: Error message in QThread

    Hi.
    Below is my .pro file.
    I'm using QT creator as my IDE.
    Yes. I've implemented my slots.
    I think you're right. I'm missing the moc codes.
    So, how do I ask QT creator to build moc codes?

    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2011-04-25T10:51:02
    4. #
    5. #-------------------------------------------------
    6.  
    7. QT += core gui
    8.  
    9. TARGET = mylittleProgram
    10. TEMPLATE = app
    11.  
    12.  
    13. SOURCES += main.cpp\
    14. mainwindow.cpp \
    15. mylittleheader.cpp \
    16. mylittlerender.cpp \
    17. mylittlereaddata.cpp \
    18. mythread.cpp
    19.  
    20. HEADERS += mainwindow.h \
    21. mylittleheader.h \
    22. mylittlerender.h \
    23. mylittlereaddata.h \
    24. mythread.h
    25.  
    26.  
    27. FORMS += mainwindow.ui
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Error message in QThread

    It should do it automatically.
    .pro file looks ok, so I'd start by running qmake and check if Makefiles contains correct moc build targets.

Similar Threads

  1. Getting an error for QString::arg instead of message
    By akiross in forum Qt Programming
    Replies: 2
    Last Post: 9th April 2011, 10:57
  2. Message editor already in use error
    By Ismb in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 17th February 2011, 14:22
  3. error message
    By offline in forum Qt Programming
    Replies: 1
    Last Post: 5th November 2009, 14:08
  4. Showing a error message
    By srohit24 in forum Qt Programming
    Replies: 2
    Last Post: 21st August 2009, 07:05
  5. getting the error message when trying to run the application in QT
    By pallavi Boyapat in forum Qt Programming
    Replies: 49
    Last Post: 31st October 2008, 12:18

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.