title: How to initialize a static const float in a C++ class in Visual Studio
body: <p>I have a code like this:</p>
  
  <pre><code>class MyClass
  {
     private:
       static const int intvalue= 50;
       static const float floatvalue = 0.07f;
   };
  </code></pre>
  
  <p>in Visual studio 2010 and I am getting this error:</p>
  
  <pre><code>Myclasses.h(86): error C2864: 'MyClass::floatvalue : only static const integral data members can be initialized within a class
  </code></pre>
  
  <p>So how to initialize a static constant float in c++? </p>
  
  <p>If I use constructor, every time that an object of this class is created, the variable is initialized which is not good.</p>
  
  <p>apparently the code is compiled with GCC on Linux.</p>