报错内容就是在Q_INTERFACES那一行,说是
Error: Undefined interface
网上找了一圈,有说是moc路径设置的问题,这个需要针对vs2019,我使用的qtcreator,所以不相关。
然后找到官方网站论坛,也没有找到具体答案,只是说没解决。最后跑到万能的stackoverflow这里,
Those wrong absolute paths led to the "undefined interface" error (which is nothing less but a "file not found" error in the case of a needed interface file) when compiling the moc files.
也就是说,这相当于报错:文件没找到。
通常就是找不到路径,编译器会报:找不到....xxxx.h之类的,但Interface却不会报找不到头文件啥的;顺着这个思路,在引用头文件的地方逐个检查,最终发现了某个#include中的路径错误,修正后就解决了。
本文结束。