title: error LNK2005: "already defined in SkinHeaderCtrl.obj"
body: <p>I am Getting this error "Error  2   error LNK2005: "public: virtual __thiscall CMemDC::~CMemDC(void)" (??1CMemDC@@UAE@XZ) already defined in SkinHeaderCtrl.obj C:\Users\anthonyd\Desktop\ASPX\STP\nafxcwd.lib(afxglobals.obj)  STP
  "</p>
  
  <p>I have read through many similar questions but can not find what fits. Could someone help please?</p>
  
  <pre><code>   // SkinHeaderCtrl.cpp : implementation file
  //
  
  #include "stdafx.h"
  #include "STP.h"
  #include "SkinHeaderCtrl.h"
  #include "memdc.h"
  
  #ifdef _DEBUG
  #define new DEBUG_NEW
  #undef THIS_FILE
  static char THIS_FILE[] = __FILE__;
  #endif
  
  #define BACKGROUND RGB(218,218,218)// was 218,218,218
  #define HEIGHT 16
  /////////////////////////////////////////////////////////////////////////////
  // CSkinHeaderCtrl
  
  CSkinHeaderCtrl::CSkinHeaderCtrl()
  {
  }
  
  CSkinHeaderCtrl::~CSkinHeaderCtrl()
  {
  }
  
  
  BEGIN_MESSAGE_MAP(CSkinHeaderCtrl, CHeaderCtrl)
      //{{AFX_MSG_MAP(CSkinHeaderCtrl)
      ON_WM_PAINT()
      ON_WM_ERASEBKGND()
      //}}AFX_MSG_MAP
  END_MESSAGE_MAP()
  
  /////////////////////////////////////////////////////////////////////////////
  // CSkinHeaderCtrl message handlers
  
  void CSkinHeaderCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
  {
  
  }
  
  void CSkinHeaderCtrl::OnPaint() 
  {
      CPaintDC dc(this); // device context for painting
  
      CRect rect, rectItem, clientRect;
      GetClientRect(&amp;rect);
      GetClientRect(&amp;clientRect);
      CMemDC memDC(&amp;dc, rect);
      CDC bitmapDC;
      bitmapDC.CreateCompatibleDC(&amp;dc);
  
  //  memDC.FillSolidRect(&amp;rect, RGB(76,85,118));
      memDC.FillSolidRect(&amp;rect, BACKGROUND);
  
      CBitmap bitmapSpan;
      bitmapSpan.LoadBitmap(IDB_COLUMNHEADER_SPAN);
      CBitmap* pOldBitmapSpan = bitmapDC.SelectObject(&amp;bitmapSpan);
  
  //  memDC.StretchBlt(rect.left+2, 0, rect.Width(), 12, &amp;bitmapDC, 0, 0, 1, 12, SRCCOPY);
      memDC.StretchBlt(rect.left+2, 0, rect.Width(), HEIGHT, &amp;bitmapDC, 0, 0, 1, 12, SRCCOPY);
  
      bitmapDC.SelectObject(pOldBitmapSpan);
      bitmapSpan.DeleteObject();
  
      int nItems = GetItemCount();
  
      CBitmap bitmap;
      CBitmap bitmap2;
      CBitmap bitmap3;
  </code></pre>
  
  <p>Here is the skinheaderctrl.h</p>
  
  <pre><code>#if !defined(AFX_SKINHEADERCTRL_H__8B0847B1_B4E6_4372_A62D_038582FFEA5C__INCLUDED_)
  #define AFX_SKINHEADERCTRL_H__8B0847B1_B4E6_4372_A62D_038582FFEA5C__INCLUDED_
  
  #if _MSC_VER &gt; 1000
  #pragma once
  #endif // _MSC_VER &gt; 1000
  // SkinHeaderCtrl.h : header file
  //
  
  
  /////////////////////////////////////////////////////////////////////////////
  // CSkinHeaderCtrl window
  
  class CSkinHeaderCtrl : public CHeaderCtrl
  {
  // Construction
  public:
      CSkinHeaderCtrl();
  
  // Attributes
  public:
  
  // Operations
  public:
  
  // Overrides
      // ClassWizard generated virtual function overrides
      //{{AFX_VIRTUAL(CSkinHeaderCtrl)
      //}}AFX_VIRTUAL
  
  // Implementation
  public:
      virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
      virtual ~CSkinHeaderCtrl();
  
      // Generated message map functions
  protected:
      //{{AFX_MSG(CSkinHeaderCtrl)
      afx_msg void OnPaint();
      afx_msg BOOL OnEraseBkgnd(CDC* pDC);
      //}}AFX_MSG
  
      DECLARE_MESSAGE_MAP()
  };
  
  /////////////////////////////////////////////////////////////////////////////
  
  //{{AFX_INSERT_LOCATION}}
  // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  
  #endif // !defined(AFX_SKINHEADERCTRL_H__8B0847B1_B4E6_4372_A62D_038582FFEA5C__INCLUDED_)
  </code></pre>
  
  <p><strong><em>Update</em></strong> </p>
  
  <p>On the skinheaderctrl.cpp I have a includes #include "memdc.h" do I want to update this to CMemDC?</p>