View Single Post
  #1 (permalink)  
Old December 2nd, 2007, 04:17 PM
Spasticus Spasticus is offline
Authorized User
 
Join Date: Oct 2005
Location: Gateshead, Tyne and Wear, United Kingdom.
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Linker Error when buidling Sketcher - Chapter 14

I followed the instructions to page 754 (Running Sketcher).
Then when I tried to build it, I got these linker errors:

Compiling...
Elements.cpp
Linking...
Elements.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CElement::Draw(class CDC *)" (?Draw@CElement@@UAEXPAVCDC@@@Z)
C:\Documents and Settings\Danny Crossley\My Documents\Visual Studio 2005\Projects\Ivor\Practice\Sketcher\Debug\Sketche r.exe : fatal error LNK1120: 1 unresolved externals

This is not very helpful. Clicking on the error messages does nothing and pressing F1 just repeats the error message in similarly vague terms. Can anybody tell me how to find out where these "unresolved externals" are in my code? I compared it with the code I typed in with the code from the book and cannot see any difference.

Dan Crossley

P.S. I've found the error:

class CElement : public CObject
{
protected:
    COLORREF m_Color; // Colour of an element
    CRect m_EnclosingRect; // Rectangle enclosing an element
    int m_Pen; // Pen width
public:
    virtual ~CElement();
    virtual void Draw(CDC* pDC) {} // I HAD A SEMICOLON INSTEAD OF {}
__________________
Dan Crossley