title: How to initialize a static member
body: <p>I want to initialize two static data members. See the two files</p>
  
  <pre><code>// Logger.h   
  
  class Logger
  {
      public:
          static LoggerConcrete error;
          static LoggerConcrete write;
  };
  </code></pre>
  
  <p>and</p>
  
  <pre><code>//Logger.cpp
  
  Logger::error = LoggerConcrete(LOG_DEBUG);
  Logger::write = LoggerConcrete(LOG_DEBUG);
  </code></pre>
  
  <p>The initilization of the two static members in Logger.cpp doesn't work.
  I get the following compiler (g++) error:</p>
  
  <blockquote>
    <p>g++ -O0 -g3 -Wall -c
    -fmessage-length=0 -MMD -MP -MF"Logger.d" -MT"Logger.d" -o"Logger.o" "../Logger.cpp" ../Logger.cpp:13: error: expected
    constructor, destructor, or type
    conversion before '=' token
    ../Logger.cpp:14: error: expected
    constructor, destructor, or type
    conversion before '=' token</p>
  </blockquote>
  
  <p>I want to use Logger::write and Logger::error in each class in which I include Logger.h. How do I have to initialize these two members?</p>