title: LNK 2001 : unresolved external symbol while initializing static member
body: <p>I am trying to implement a vitual Keyboard class for that I am having different keyboard layouts as shown.</p>
  
  <p>KeyBoard.hpp</p>
  
  <pre><code> class CKeyBoard 
   {
      public:
  
      enum eKeyBoardLayout
      {
          UPPER_CASE_ALPHABETS,
          LOWER_CASE_ALPHABETS,
          UPPER_CASE_NUMBERS,
          LOWER_CASE_NUMBERS,
          MAX_KEYBOARDLAYOUTS,
      };
      CKeyBoard();
      void hideCharacters(bool hide); // for password
      void setDisplayBufferLength(UNSIGNED8_T maxCharToDisplay);
      virtual ~CKeyBoard();
      static const UNSIGNED8_T const_noOfRows = 0x03; // 3 rows for character keys
      struct SLayout
      {
          UNSIGNED8_T noOfColumns[const_noOfRows];    ///&lt; noofcolumns in each row may be different
          TypedText     textAreaFont; 
          const KeyMapping* pKeyMapping;
      };
      static const SLayout m_KeyBoardLayouts[MAX_KEYBOARDLAYOUTS];
  private:
      /*methods*/
      void setKeyBoardLayout(eKeyBoardLayout);
      void backspacePressedHndlr();
      void letterCasePressedHndlr();
      void alphabetNumberToggleHndlr();
      /*members*/
      static const UNSIGNED8_T const_maxNoOfKeysSupprtd = 26;
      CKey m_keyArray[const_maxNoOfKeysSupprtd]; 
      CMenuItem m_KeySpaceBar;
      CMenuToggle m_KeyCaseSwitch;
      CMenuToggle m_KeyAlphaNum;
      CMenuItem m_keyBackSpace;
      eKeyBoardLayout m_eCurrentKeyLayout;
      CKeyBoardDisplayArea m_DisplayArea;
  </code></pre>
  
  <p>};</p>
  
  <p>I am initialising the static member as follows in cpp file.
  KeyBoard.cpp</p>
  
  <pre><code>static const CKeyBoard::SLayout   m_KeyBoardLayouts[CKeyBoard::MAX_KEYBOARDLAYOUTS] = \
    {
        //      UPPER_CASE_ALPHABETS,
      {
        { 10, 9, 7 },
          TypedText(T_KEYBOARD),
          &amp;keyMappingsAlphaUpper[0],
  
  },
  //      LOWER_CASE_ALPHABETS,
  {
      { 10, 9, 7 },
      TypedText(T_KEYBOARD),
      &amp;keyMappingsAlphaLower[0],
  },
  //      UPPER_CASE_NUMBERS,
  {
      { 10, 10, 5 },
      TypedText(T_KEYBOARD),
      &amp;keyMappingsNumLower[0],
  },
  //      LOWER_CASE_NUMBERS,
  {
      { 10, 10, 5 },
      TypedText(T_KEYBOARD),
      &amp;keyMappingsNumLower[0]
  },
  
  
  };
  // Other function definitions
  CKey::CKey() : m_pCallback(NULL)
  {
  }
  </code></pre>
  
  <p>But still I am getting unresolved external symbol as linker error. 
  What am I doing wrong here?</p>
  
  <p>Error Details:
  *
  error LNK2001: unresolved external symbol "public: static struct CKeyBoard::SLayout const * const CKeyBoard::m_KeyBoardLayouts" (?m_KeyBoardLayouts@CKeyBoard@@2QBUSLayout@1@B) 
  *</p>