Click to See Complete Forum and Search --> : Another problem with MOC (I MOCed the headers and defined QOBJECT)


Bob54325
02-03-2002, 04:17 PM
I am having another problem with MOC (I MOCed the headers and defined QOBJECT). The header file moc is having difficulty with is the following:


#ifndef QUIZZER_H
#define QUIZZER_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <kapp.h>
#include <ktmainwindow.h>
#include <qwidget.h>
#include <kurl.h>

class KRecentFilesAction;
class EditCards;
class quizCore;

/** Quizzer is the base class of the project */
class Quizzer : public KTMainWindow
{
Q_OBJECT
public:
/** construtor */
Quizzer(const char *name=0);
/** destructor */
~Quizzer();

protected slots:
void slotNew();
void slotOpen();
void slotSave();
void slotQuizRandom();
void slotQuizOrder();
void slotQuizManual();
void slotEdit();
void slotOpenRecent(const KURL&);

private:
KRecentFilesAction *recent;
KURL file;
EditCards *mode1;
quizCore *mode2;
};

#endif


I do make (tmake handles moc) and I get this error:

moc/moc_quizzer.o: In function `Quizzer::staticMetaObject(void)':
/home/ptz/quizzer/moc/moc_quizzer.cpp:89: undefined reference to `Quizzer::slotO
penRecent(KURL const &)'
collect2: ld returned 1 exit status
make: *** [quizzer] Error 1

The implementation of slotOpenRecent is the following:


void slotOpenRecent(const KURL& kurl)
{
}


Please ,please help.

Qubit
02-04-2002, 01:53 PM
You've already made that error before :D

It's gotta be
void Quizzer::slotOpenRecent(const KURL& kurl)

If you let out the quizzer scope specifier the compiler thinks slotOpenRecent is an ordinary function.

Strike
02-04-2002, 05:25 PM
Originally posted by Glaurung:
<STRONG>You've already made that error before :D

It's gotta be
void Quizzer::slotOpenRecent(const KURL& kurl)

If you let out the quizzer scope specifier the compiler thinks slotOpenRecent is an ordinary function.</STRONG>
Not only that, but every member function of that class needs to be defined within the scope of that class as well.

Bob54325
02-04-2002, 09:22 PM
Whoops. I think I made every mistake you can possibly make in moc except for fogeting to comile and forgetting to link. Thank you so very much for answering my question. I really appreciate it.