title: C++ structs defined in header and implemented in cpp
body: <p>How can i make sure that the somecolor that i implement keeps his value when you use it in another class?</p>
  
  <p><strong>struct.h</strong></p>
  
  <pre><code>struct Color{
     unsigned char r;
     unsigned char g;
     unsigned char b;
  };
  Color someColor;
  //if i define the color here it says...:
  Color someColor = {255,255,255}; //error: data member inializer not allowed
  </code></pre>
  
  <p><strong>struct.cpp</strong></p>
  
  <pre><code>struct::Color someColor = {255,255,255};
  </code></pre>
  
  <p><strong>someotherclass.cpp</strong></p>
  
  <pre><code>struct *str = new struct();
  str-&gt;someColor.r //is not the correct value /not set
  </code></pre>