This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with C++ code.

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.

  • Also the Memory MAP listing...

           VALUE       PUBLIC SYMBOL NAME               REP   TGR  CLASS   SECTION
          =======================================================================
          ...
          *EXTRN*     __nw__FUi                        ---   ---  ---     ---
          *EXTRN*     __vtbl__6TPoint                  ---   ---  ---     ---
          ...
    
    
    UNRESOLVED EXTERNAL SYMBOLS:
       TGR: 0  NAME: __nw__FUi
       TGR: 0  NAME: __vtbl__6TPoint
    

  • Did you define your virtual functions properly, especially in the base class? If there is no definition for them, the EC++ parser won't generate the virtual table, and that would lead to the linkage errors that you're seeing (the "unresolved __vtbl__yadda" symbol)

    Good luck,

    Steph-