Problem using static variable in a static function
<p>i have a full static class, using a std::map</p>

<p>thats the simplified case</p>

<p><strong>.h</strong></p>

<pre><code>#ifndef KEYBOARD_H
#define KEYBOARD_H

#include &lt;map&gt;

class Keyboad {

    static std::map&lt;char, bool&gt; pressed;    

    static void keyPressedEvent(char _key); 

};

#endif
</code></pre>

<p><strong>.cpp</strong></p>

<pre><code>#include "Keyboard.h"

void Keyboard :: keyPressedEvent(char _key) {

    Keyboard :: pressed[_key] = true;

}
</code></pre>

<p>but there is a problem with the static member variable, because i get</p>

<pre><code>Undefined symbols:
"Keyboard::pressed", referenced from:
__ZN15Keyboard7pressedE$non_lazy_ptr in Keyboard.o
(maybe you meant: __ZN15Keyboard7pressedE$non_lazy_ptr)
ld: symbol(s) not found
collect2: ld returned 1 exit status
</code></pre>

<p>when i remove it, it runs ok</p>

<p>why do i get this problem, there should be no problem when using a static variable :/</p>

<p>thanks</p>
