当前位置:网站首页>QT adds a summary of the problems encountered in the QObject class (you want to use signals and slots) and solves them in person. Error: undefined reference to `vtable for xxxxx (your class name)‘
QT adds a summary of the problems encountered in the QObject class (you want to use signals and slots) and solves them in person. Error: undefined reference to `vtable for xxxxx (your class name)‘
2022-06-12 11:52:00 【There is a long way to go】
One : Application scenarios :
1, Create a new parent class , A new subclass has been created , Inherited the parent class , Want to use signal and slot functions in subclasses . Results found connect Function cannot be used .
Two : Implementation steps
1, Add header file #include
2, Your class should inherit public QObject
3, Add a macro to the class Q_OBJECT
3、 ... and : Have a problem
1,error: undefined reference to `vtable for xxxxxx( Your class name )‘.
2,error: undefined reference to xxxxx( This is my parent class )::metaObject() const’.
3, Signal and slot functions implemented in subclasses , The result is to find the slot function in the parent class when using , No slot function found .
Four : terms of settlement
1, Since it is to be used in subclasses , Then take the parent class QObject Class related deletion
2, Write the above implementation steps in the subclass
3, Now that you have added Q_OBJECT This macro , Need to recompile the project
4, Click on qt The construction of —> Clean up all items
5, After cleaning up , Click on the building —> perform qmake( Be sure to execute first qmake, Because we need to Q_OBJECT This macro is compiled into , rewrite Makefile), Most people don't do this , Will be abnormal
6, Click on the run (80% All people will succeed )
7, If the operation is successful , congratulations , I haven't met a very wonderful bug, If the run fails , Let's see if this is my case , It's amazing !
8, Because my subclass is the inherited parent class , So I'm adding QObject Class time , Naturally put this QObject Written later : As shown in the figure below 
9, There will be problems with this implementation , Will be submitted to the error
10, hold QObject class , Write to the front , Then you can recompile it , Isn't that amazing
11, Click on the run (99.9% All people will succeed )
12, If you don't succeed , Then you are executing that implementation step , Or delete this class first , Then add again , Or put that build–debug/release Compile Directory , Delete , After recompiling , If not , I don't know , ha-ha .
5、 ... and : The successful running
I wish you all a successful operation , Hey .
边栏推荐
- IP地址管理
- How to determine the relationship between home page and search? Relationship between homepage and search
- PIP install in the CONDA environment cannot be installed into the specified CONDA environment (the default PIP installation location of the CONDA environment)
- ARM指令集之数据处理指令寻址方式
- FormatConversionTool. exe
- Promise controls the number of concurrent requests
- Analyze the implementation principle of the onion model, and connect the onion model in your own project
- Network topology
- 5g NR Protocol Learning - - ts38.211 downlink channel
- VirtualBox virtual machine shut down due to abnormal system. The virtual machine startup item is missing
猜你喜欢

Design of secure chat tool based on C #

A.前缀极差

6.6 Convolution de séparation

manuscript手稿格式准备
![[Blue Bridge Cup SCM 11th National race]](/img/da/3c8a9efd5b28f67816f239531a0339.png)
[Blue Bridge Cup SCM 11th National race]

TinyMCE series (I) TinyMCE environment construction

UML series articles (31) architecture modeling - deployment diagram

Basic principle of Doppler effect

IP地址管理

LeetCode 890. 查找和替换模式(模拟+双哈希表)
随机推荐
邻居子系统之ARP协议数据处理过程
SSL引入原因及加密步骤
5G NR协议学习--TS38.211下行通道
[foundation of deep learning] back propagation method (1)
Socket implements TCP communication flow
ARM指令集之Load/Store指令寻址方式(二)
A.前缀极差
6.6 rl:mdp and reward function
第六章 数据类型(五)
QT添加QObject类(想使用信号和槽)遇到的问题汇总,亲测解决有效error: undefined reference to `vtable for xxxxxx(你的类名)‘
ioremap
35. search insertion position
Kubernetes cluster setup
Problems in cross validation code of 10% discount
Windows10安装mysql-8.0.28-winx64
VirtualBox virtual machine shut down due to abnormal system. The virtual machine startup item is missing
manuscript手稿格式准备
6.6 separate convolution
Compiling Draco library on Windows platform
B.刷墙(C语言)