有一篇类似的文章是这样的:
> ///////////// VisInterface.h
> class VisInterface
> {
> public:
> virtual QList<VisFactory*> visualizations()const=0;
> };
> Q_DECLARE_INTERFACE(VisInterface, "flt.VisInterface")
> ///////////// End VisInterface.h
>
> ///////////// 3DVisPlugin.h
> class C3DVisPlugin : public QObject,public VisInterface
> {
> Q_OBJECT
> Q_INTERFACES(VisInterface)
> public:
> virtual QList<VisFactory*> visualizations()const;
> };
> ///////////// End 3DVisPlugin.h
>
> I get the following two warning/errors when I try to moc the files:
> MOC VisInterFace.h
> VisInterFace.h(0): Warning: No relevant classes found. No output generated.
>
> MOC 3DVisPlugin.h
> 3DVisPlugin.h(12): Error: Undefined interface
>
> I'd greatly apppreciate any help on fixing/sidestepping this problem
You don't need to run moc on VisInterface.h, but when moc'ing 3DVisPlugin.h
you need to make sure to pass the -I option with an include path that makes
it possible for moc to find VisInterface.h as you #include it in
3DVisPlugin.h.这个怎么理解啊?要哪个文件找到哪个文件?