QT_PROPERTIES gibt undefined referenz zurück
Verfasst: 17. Dezember 2008 20:38
Hallo,
wenn ich die unten stehenden Dateien kompiliere/linke bekomme ich einen "undefinded referenz" error für die beiden in Q_PROPERTIES definierten Funktionen zurück.
Ich selber sehe keinen Fehler im Programm.
x+2 Augen sehen mehr als 2 für x > 0, darum hier meine Bitte um Hilfe
HEADER
CODE
FEHLERMELDUNGEN
Description:
undefined reference to `Point::getColor()' moc_Point.cpp ShGo/debug 68 C/C++ Problem
undefined reference to `Point::setColor(int)' moc_Point.cpp ShGo/debug 74 C/C++ Problem
moc_Point.cpp
Ich nutze Eclipse Ganymed mit QT 4.4.3 auf einem 64Bit Suse 11.0 Linux System.
Vielen Dank im Vorraus
klopfer
wenn ich die unten stehenden Dateien kompiliere/linke bekomme ich einen "undefinded referenz" error für die beiden in Q_PROPERTIES definierten Funktionen zurück.
Ich selber sehe keinen Fehler im Programm.
x+2 Augen sehen mehr als 2 für x > 0, darum hier meine Bitte um Hilfe
HEADER
Code: Alles auswählen
#include<QObject>
/**
* @class Elementare Daten und Funktionen für eine Punkt auf dem Brett,
* wird in Board() genutzt
*/
class Point : public QObject
{
private:
Q_OBJECT
Q_PROPERTY(int color READ getColor WRITE setColor)
public:
Point();
~Point();
int getColor();
void setColor(int c);
bool hasCursor();
void setCursor(bool);
const static int EMPTY = 0;
const static int BLACK = 1;
const static int WHITE = 2;
void setNumber(int n);
int getNumber();
private:
int X;
int Y;
int nbr;
//int color;
bool CURSOR;
};
Code: Alles auswählen
#include "Point.h"
Point::Point() {
// TODO Auto-generated constructor stub
//color = EMPTY;
CURSOR = false;
}
/*int Point::getColor() {
return color;
}
void Point::setColor(int c) {
color = c;
}*/
bool Point::hasCursor() {
return CURSOR;
}
void Point::setCursor(bool c) {
CURSOR = c;
}
void Point::setNumber(int n) {
nbr = n;
}
int Point::getNumber() {
return nbr;
}
Point::~Point() {
// TODO Auto-generated destructor stub
}
Description:
undefined reference to `Point::getColor()' moc_Point.cpp ShGo/debug 68 C/C++ Problem
undefined reference to `Point::setColor(int)' moc_Point.cpp ShGo/debug 74 C/C++ Problem
moc_Point.cpp
Code: Alles auswählen
int Point::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< int*>(_v) = getColor(); break; /****** FEHLER 1 ********/
}
_id -= 1;
} else if (_c == QMetaObject::WriteProperty) {
void *_v = _a[0];
switch (_id) {
case 0: setColor(*reinterpret_cast< int*>(_v)); break; /******* FEHLER 2 ********/
}
_id -= 1;
} else if (_c == QMetaObject::ResetProperty) {
_id -= 1;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 1;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 1;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 1;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 1;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 1;
}
#endif // QT_NO_PROPERTIES
return _id;
}
QT_END_MOC_NAMESPACE
Vielen Dank im Vorraus
klopfer