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.

  1. Check link statements
  2. Verify that the method does indeed exist.
  3. Run qmake to regenerate the MAKEFILE
  4. 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:
  1. My program uses library A
  2. Library A uses Library B
  3. 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.