Details
-
Bug
-
Resolution: Won't Do
-
P3: Somewhat important
-
None
-
4.8.0
-
None
-
Linux x86 Qt 4.8.0
Description
Not sure if this is MOC or qmake (also unsure if this is fixed in HEAD, unable to test atm), but here's the steps to reproduce:
Create two classes. One BaseClass that inherits from QObject, and one InheritedClass that inherits from BaseClass. Put the Q_OBJECT macro in the BaseClass, but do not put it in the Inherited Object (as you should). Add some test signals to each, yada yada.
In that configuration, the compiler will spit out:
"undefined reference to `InheritedClass::inheritedSignal`"
Next, add the Q_OBJECT macro to the InheritedClass (should fix it) and see that it is still broken. This time with error:
"undefined reference to `vtable for InheritedClass`"
After doing Build->Clean and Build->Rebuild All (should also fix the problem), you get the same error as directly above:
"undefined reference to `vtable for...`"
After manually deleting the build folder, the compilation works as expected.
Only after a successful build, if you now remove the Q_OBJECT macro from InheritedClass, you get the friendly error:
"Class declaration lacks Q_OBJECT macro."
That friendly error should be spat out the first time the Q_OBJECT macro is missing. Adding the Q_OBJECT macro should also fix the problem without needing to delete the build folder (is MOC/qmake not detecting the change and regenerating it's output?). Cleaning should have the same effect as deleting the build folder.
Attachments
Issue Links
- is duplicated by
-
QTBUG-34057 undefined value of enum in derived class
- Closed
- relates to
-
QTBUG-35176 QML import-scanner runs at qmake time, not as extra compiler that depends on qml files
- Open
-
QTCREATORBUG-13917 undefined reference to `vtable for... persist after "rebuild" , "clean all"
- Closed
-
QTBUG-55319 What the hell:modify header file won't trigger recompile of the source that include that header
- Closed
- replaces
-
QTCREATORBUG-21075 .pro file is not reloading before compilation and linking
- Closed
- resulted in
-
QTCREATORBUG-231 Creator should know when to rerun qmake
- Closed