错误是这样的:
unresolved external symbol "private: static class CIndentWnd *  CIndentWnd::pIndent" (?pIndent@CIndentWnd@@0PAV1@A)
我的代码是这样:
//缩略图窗口
class CIndentWnd : public CFrameWnd  
{
private:
CIndentWnd();
static CIndentWnd *pIndent;public:
void Update(HBITMAP hBitmap);
static CIndentWnd* GetInstance();
HBITMAP m_hBmpPuzzle;
afx_msg void OnPaint();
~CIndentWnd(); DECLARE_MESSAGE_MAP()};
// 消息映射
BEGIN_MESSAGE_MAP(CIndentWnd, CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()编译能通过,可连接不行,怎么回事?

解决方案 »

  1.   

    在cpp文件中加上
    static CIndentWnd* CIndentWnd::pIndent = NULL;
      

  2.   

    不行,直接就编译失败
    error C2720: 'pIndent' : 'static ' storage-class specifier illegal on members我初始化也不行:
    CIndentWnd::pIndent = NULL;也有错误:
    error C2501: 'pIndent' : missing storage-class or type specifiers
    error C2040: 'public: static class CIndentWnd *  CIndentWnd::pIndent' : 'int' differs in levels of indirection from 'class CIndentWnd *'
      

  3.   

    我知道了,要加上CIndentWnd* CIndentWnd::pIndent = NULL;
    不要static