Qt "undefined reference to ' vtable for" Error resolution (manual resolution, deeper understanding)

Source: Internet
Author: User

When using QT programming, when a user customizes a class, a signal or slot is used as long as the class.
Code::Blocks compile will error (undefined reference to ' vtable for).

There are many answers to this question on Google, but many of them are vague or not feasible at all.

In fact, QT has its own method of compiling.

Without the IDE writing a class, QT compiles the steps:
1, CD source code directory
2, Qmake-project
3, Qmake Project_name.pro
4, make (if you have MinGW, use Mingw-make.exe)

In view of this, we add 3 items in Code::Blocks tools-->config tools-->add See figure:

Note: The first character of all paramiters above must be a space.

Once setup is complete, compile the project as long as you do this:
Tools--> Select Qmake-project, wait finished-select Qmake, wait finished-select Mingw-make, wait complete.
This completes the compilation.

Note: All source code must be placed in the root directory of the project.
You also need to make environment variables:
In path add: E:\QT\bin; E:\CodeBlocks\MinGW\bin

Of course, these are absolute paths and you need to change them to the path on your computer.


Qt "undefined reference to ' vtable for" Error resolution (manual resolution, deeper understanding)

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.