tags:

views:

882

answers:

2

ok wtf this is what moc tells me when i try to moc one of my header files. im doing this through Qt 4.5.3 command prompt and it says this:

C:\Documents and Settings\The Fuzz\Desktop\GUI2>moc App_interface.h
/****************************************************************************
** Meta object code from reading C++ file 'App_interface.h'
**
** Created: Mon Oct 12 16:58:11 2009
**      by: The Qt Meta Object Compiler version 61 (Qt 4.5.3)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#include "App_interface.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'App_interface.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 61
#error "This file was generated using the moc from 4.5.3. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif

QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_App_interface[] = {

 // content:
       2,       // revision
       0,       // classname
       0,    0, // classinfo
       0,    0, // methods
       0,    0, // properties
       0,    0, // enums/sets
       0,    0, // constructors

       0        // eod
};

static const char qt_meta_stringdata_App_interface[] = {
    "App_interface\0"
};

const QMetaObject App_interface::staticMetaObject = {
    { &QWidget::staticMetaObject, qt_meta_stringdata_App_interface,
      qt_meta_data_App_interface, 0 }
};

const QMetaObject *App_interface::metaObject() const
{
    return &staticMetaObject;
}

void *App_interface::qt_metacast(const char *_clname)
{
    if (!_clname) return 0;
    if (!strcmp(_clname, qt_meta_stringdata_App_interface))
        return static_cast<void*>(const_cast< App_interface*>(this));
    return QWidget::qt_metacast(_clname);
}

int App_interface::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    return _id;
}
QT_END_MOC_NAMESPACE

C:\Documents and Settings\The Fuzz\Desktop\GUI2>

any ideas??? im trying to use the Q_OBJECT Macro.

+2  A: 

moc converts its input header into a generated file, which is printed on its output. You should send its output to a file, with a command like:

moc App_interface.h > App_interface.h_moc

then include that.

If you're using QMake, I believe this process is automated.

John Millikin
qmake and the command you gave me didn't work.
TheFuzz
so i just now discovered that the commands'qmake -project' then 'make' create a debug file with the debug/moc_App_interface.cpp. Now my program works. how can i automate this so i dont have to compile new cpp files everytime?
TheFuzz
A: 

This may also help: you need to inherit from QObject before other classes: http://doc.trolltech.com/4.1/moc.html#multiple-inheritance-requires-qobject-to-be-first.

As per the previous reply, it's much better to use qmake.

I'd strongly recommend using an IDE Qt Creator, rather than building from the command line.

Sam Dutton