1. Description of problems encountered
An error occurred in a constructor during compilation:
1 error: undefined reference to ‘vtable for XXX’
2. Cause analysis
Cause of error: This usually occurs in a class that inherits QObject. It is usually a newly defined subclass that does not implement the pure virtual function of the parent class.
In QT, when you encounter this situation, you should first think of adding a new class inherited from QObject to a class and adding Q_ The macro object,
After that, this error will be reported whether it is built or rebuilt. The root cause is that only build and rebuild will be performed without compiling Q_ Object macro (and no new MOC file will be generated),
Therefore, you need to execute qmake first and let the MOC compiler precompile Q_ Object macro. PS: you can execute qmake once before running the program
3. Solutions
Re-execute qmake and rebuild.
Generally, this problem is solved to avoid forgetting to take notes~
Similar Posts:
- qt *undefined reference to `vtable for xxx solution programme
- Qt undefined reference to `vtable for * * * ‘
- Git Permission issues: insufficient permission for adding an object to repository database .git
- QSpinBox: How to Solve Two signals with the same name processed error
- [Solved] Fatal error: OpenSSL/EVP. H: there is no such file or directory
- Redis service failed to start, prompt: redis server: command not found
- Error link: fatal error lnk1158: unable to run ‘RC. Exe’
- [Solved] NPM installation error: error: eacces: permission denied
- [Solved] IDEA Startup Error: Cound not Find or Load the main class