Add a custom class to QT, and the "undefined reference to vtable for" solution appears (eclipse + linux)

Source: Internet
Author: User

Use eclipse to develop qt gui applications. If you want to customize a class, you need to use the signal/slot mechanism. Therefore, add it to the custom class.Q_objectMacro. However, an error is reported during build! Shape:

Undefined reference to vtable

I found the cause after checking on the Internet for a long time 《

Qt causes of "undefined reference to 'vtable"
, But the solution is too operability.



Undefined reference to 'vtable for 'Solution

The solution is informative, but not in the Eclipse IDE development environment.

So continue to search .....

In the 'undefined reference to vtable' when inheriting from qobjec
T found the solution:

If you are using qmake sometimes you have to delete all your makefiles
And regenerate them to get your new header file MOC 'ed

Therefore, right-click the Eclipse project and choose "Clean Project". All makefile files are generated again. Build again,No problem
.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.