Qt4 moc problem

Simon Hausmann hausmann at kde.org
Thu Jan 19 07:43:46 CET 2006


On Wednesday 18 January 2006 23:57, Alexander Neundorf wrote:
> Hi,
>
> moc running moc on some files in kdelibs/kdecore, it says: no relevant
> classes found, e.g. for kmanagerselection.h and kwinmodule.h
>
> Both have an ifdef:
>
> #ifdef Q_OS_UNIX
> in kwinmodule.h and
> #ifdef Q_WS_X11
> in kmanagerselection.h
>
> It produces the correct moc file if I call it
> moc -DQ_OS_UNIX -DQ_WS_X11 kwinmodule.h -o kwinmodule.moc
>
> Is this the intended usage ?
>
> moc -I $(QT4DIR)/include kwinmodule.h -o kwinmodule.moc
>
> doesn't help, still no output.
>
> Any hints ?

kwinmodule.h uses #include <qobject.h> for header file inclusion, hence it 
needs $QTDIR/include/Qt in the include path. The Qt headers use #include 
<Module/headerfile.h>, hence they need $QTDIR/include. Q_OS_UNIX is defined 
in qglobal.h which through some intermediate header file is included as 
#include <QtCore/qglobal.h>, which moc does not find with your specified 
include search paths. So the solution is simply to use the same include paths 
that you're also using for compiling the file.


Simon


More information about the Kde-buildsystem mailing list