I am working on a simple drawing widget in Qt (all of the following is within one class). In the header file, I have defined
private:
QPointF translateToCanvas (QPointF input);
and in the CPP file I have defined
QPointF translateToCanvas (QPointF input) {
return input - QPointF(CANVAS_MARGIN_X, CANVAS_MARGIN_Y);
}
Somewhere else in the code, I call this with
QPointF newPoint = translateToCanvas(anotherPoint);
Whenever I compile, it gives me the error "undefined reference to `MyClass::translateToCanvas(QPointF)'", and this is happening inside the stuff that moc's generating and not actually my literal code.
What could be causing this error in Qt? (I'm using Qt Creator with Qt 4.5.)