Please help! I'm trying to compile & link followong code...
class TLocation { private: unsigned int X; unsigned int Y; public: TLocation(unsigned int InitX = 0, unsigned int InitY = 0) {X = InitX; Y = InitY;} unsigned int GetX(void) {return X;} unsigned int GetY(void) {return Y;} }; //------------------------------------------------------------------------------ class TPoint : public TLocation { private: unsigned int Color; bool Visible; public: TPoint(unsigned int InitX, unsigned int InitY, unsigned int Col); virtual void Hide(void); virtual void Show(void); virtual void MoveTo(unsigned int StepX, unsigned int StepY); ~TPoint(void); }; //------------------------------------------------------------------------------ TPoint::TPoint(unsigned int InitX, unsigned int InitY, unsigned int Col) : TLocation(InitX, InitY) { Color = Col; Visible = false; } //------------------------------------------------------------------------------
This code compiles OK without any errors. But linking project gives the following error...
*** ERROR L127: UNRESOLVED EXTERNAL SYMBOL SYMBOL: __dt__6TPointFv MODULE: Graph.obj (GRAPH) *** ERROR L127: UNRESOLVED EXTERNAL SYMBOL SYMBOL: __vtbl__6TPoint MODULE: Graph.obj (GRAPH) *** ERROR L127: UNRESOLVED EXTERNAL SYMBOL SYMBOL: __nw__FUi MODULE: Graph.obj (GRAPH) *** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: __dt__6TPointFv MODULE: Graph.obj (GRAPH) ADDRESS: 0E5AH *** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: __nw__FUi MODULE: Graph.obj (GRAPH) ADDRESS: 0E76H *** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: __vtbl__6TPoint MODULE: Graph.obj (GRAPH) ADDRESS: 0E96H Target not created
The problem apears when I describe CONSTRUCTOR TPoint out of class(not inline). In class Location CONSTRUCTOR is INLINE - NO problem with linking! If the CONSTRUCTOR NOT INLINE arises problems.