I spent much time today solving vtable issues, and similar linkage issues. I thought that I would share my findings.
I have a class derived from QObject. I added the Q_OBJECT macro, and suddenly I had vtable issues with the class. All you QT veterans are smiling and nodding, because you know that I needed to run qmake to regenerate the make the file.
- Check link statements
- Verify that the method does indeed exist.
- Run qmake to regenerate the MAKEFILE
- Only use the Q_OBJECT macro in a header file.
My next issue was subtle. My opinion is that this is probably a compiler error, but, I have not pursued it. This is a bit convoluted:
- My program uses library A
- Library A uses Library B
- While linking, some classes defined in Library B and used in Library A are not available (link issues).
I have not pursued this entirely, but, I solved the problem by instantiating a class instance in my program. Defining an instance in library B did not help.
I was very surprised by this.
Bookmarks