Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error when compiling QT (with moc)

0 views
Skip to first unread message

Asgd

unread,
Jul 23, 2000, 3:00:00 AM7/23/00
to
I´m trying to learn how to program with QT and now I got stuck at the
using of moc. I use QT 1.1.0 beta1.
I include the moc file (#include "mocfile.moc") in my .cpp-file right
after the class-declaration. I´ve put in Q_OBJECT first in my
class-declaration.
The compilation procedure look like this:
moc -o mocfile.moc cppfile.cpp
progen > cppfile.pro
tmake -o Makefile cppfile.pro
make

and then this errormessage outputs:
_______________________________________
In file included from scribble2.cpp:46:
scribble2.moc:44: new declaration `static void
ScribbleWindow::staticMetaObject()'
scribble2.cpp:15: ambiguates old declaration `static class QMetaObject *

ScribbleWindow::staticMetaObject()'scribble2.moc: In function `(static
initializers for scribble2.cpp)':
scribble2.moc:28: no matching function for call to
`QMetaObjectInit::QMetaObjectInit (QMetaObject * (*)())'
/usr/lib/qt-2.1.0/include/qmetaobject.h:220: candidates are:
QMetaObjectInit::QMetaObjectInit(const QMetaObjectInit &)
/usr/lib/qt-2.1.0/include/qmetaobject.h:218:
QMetaObjectInit::QMetaObjectInit(void (*)())
make: *** [scribble2.o] Error 1
_________________________________________

Any ideés?
/Asgd


David Faure

unread,
Jul 25, 2000, 3:00:00 AM7/25/00
to
Did you protect your header file against multiple inclusion
(the usual #ifndef/#define/.../#endif) ?

Also, are you sure that the "moc" in your path is indeed the one of Qt
2.1.0 ?
Looks like it's the one for 1.4x.
Use $QTDIR/bin/moc instead, if your QTDIR is set.

--
David Faure
fa...@kde.org - KDE developer
da...@mandrakesoft.com - Mandrake
See http://www.kde.org/kde1-and-kde2.html for how to set up KDE 2.

0 new messages