• 18.07.2025, 13:33
  • Register
  • Login
  • You are not logged in.

 

Eumel

God

Qt: Q_OBJECT - Makro-Fehler

Saturday, February 12th 2005, 12:04pm

Hi!

Wenn ich in einer Klasse Signals/Slots schreibe, muss ich ja das Q_OBJECT-Makro aufrufen.

Dann kommt aba ein Linker-Fehler.

Was mach ich falsch?

Quoted

Verknüpfen...
lcdrange.obj : error LNK2001: Nichtaufgelöstes externes Symbol "public: virtual bool __thiscall LCDRange::qt_property(int,int,class QVariant *)" (?qt_property@LCDRange@@UAE_NHHPAVQVariant@@@Z)
lcdrange.obj : error LNK2001: Nichtaufgelöstes externes Symbol "public: virtual bool __thiscall LCDRange::qt_emit(int,struct QUObject *)" (?qt_emit@LCDRange@@UAE_NHPAUQUObject@@@Z)
lcdrange.obj : error LNK2001: Nichtaufgelöstes externes Symbol "public: virtual bool __thiscall LCDRange::qt_invoke(int,struct QUObject *)" (?qt_invoke@LCDRange@@UAE_NHPAUQUObject@@@Z)
lcdrange.obj : error LNK2001: Nichtaufgelöstes externes Symbol "public: virtual void * __thiscall LCDRange::qt_cast(char const *)" (?qt_cast@LCDRange@@UAEPAXPBD@Z)
lcdrange.obj : error LNK2001: Nichtaufgelöstes externes Symbol "public: virtual char const * __thiscall LCDRange::className(void)const " (?className@LCDRange@@UBEPBDXZ)
lcdrange.obj : error LNK2019: Nicht aufgelöstes externes Symbol '"public: static class QMetaObject * __cdecl LCDRange::staticMetaObject(void)" (?staticMetaObject@LCDRange@@SAPAVQMetaObject@@XZ)', verwiesen in Funktion '"public: virtual class QMetaObject * __thiscall LCDRange::metaObject(void)const " (?metaObject@LCDRange@@UBEPAVQMetaObject@@XZ)'


Header-Datei:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class LCDRange : public QVBox
{
    Q_OBJECT
public:
    LCDRange( QWidget *parent=0, const char *name=0 );

    int value() const;

public slots:
    void setValue( int );

signals:
    void valueChanged( int );

private:
    QSlider *slider;
};


MfG
"I've always said, the Web is the sum of all human knowledge plus porn.", Ron Gilbert
UltraStar Manager 1.7.2 | Infos zu meinem PC | .o0 DeathSpank 0o.

Y0Gi

God

Re: Qt: Q_OBJECT - Makro-Fehler

Saturday, February 12th 2005, 1:19pm

hast du keine includes im header??

grad mal in ein paar sourcen von mir geschaut, da sieht der teil aber sehr ähnlich aus. sicher, dass es genau an dem teil im header liegt und nicht an was anderem?

haste auch richtig neu kompiliert, also mal tempfiles gelöscht und so? wir hatten da mit kdevelop und der moc-bande richtig stress.

Eumel

God

Re: Qt: Q_OBJECT - Makro-Fehler

Saturday, February 12th 2005, 4:10pm

Wenn ich das Makro rausmache, lässt es sich compilieren ;)

Aber dann werden die Slots/Signals nich bearbeitet.

Exakt dieses Beispiel hab ich reinkopiert:
http://doc.trolltech.com/3.3/tutorial1-07.html

MfG

Edit: Ich hab das Gefühl noch keine Ahnung von MOC zu haben, aber zu wissen, dass er nicht richtig arbeitet :D

2. Edit: Hab den MOC-Button in Visual Studio gefunden ;D ! !
"I've always said, the Web is the sum of all human knowledge plus porn.", Ron Gilbert
UltraStar Manager 1.7.2 | Infos zu meinem PC | .o0 DeathSpank 0o.

Y0Gi

God

Re: Qt: Q_OBJECT - Makro-Fehler

Saturday, February 12th 2005, 9:20pm

also gates jetzt?

Eumel

God

Re: Qt: Q_OBJECT - Makro-Fehler

Sunday, February 13th 2005, 11:25am

Quoted from "Y0Gi"

also gates jetzt?


Jo! :D

MfG
"I've always said, the Web is the sum of all human knowledge plus porn.", Ron Gilbert
UltraStar Manager 1.7.2 | Infos zu meinem PC | .o0 DeathSpank 0o.