title: Define static method in source-file with declaration in header-file in C++
body: <p>I am having a little trouble working with static methods in C++</p>
  
  <p>Example .h:</p>
  
  <pre><code>class IC_Utility {
  public:
      IC_Utility();
      ~IC_Utility();
  
      std::string CP_PStringToString( const unsigned char *outString );
      void CP_StringToPString( std::string&amp; inString, unsigned char *outString, short inMaxLength );
      static void CP_StringToPString( std::string&amp; inString, unsigned char *outString);
      void CP_StringToPString( FxString&amp; inString, FxUChar *outString);
  
  };
  </code></pre>
  
  <p>Example .cpp:</p>
  
  <pre><code>static void IC_Utility::CP_StringToPString(std::string&amp; inString, unsigned char *outString)
  {
      short       length = inString.length();
  
     if( outString != NULL )
      {
          if( length &gt;= 1 )
              CPLAT::CP_Utility::CP_CopyMemory( inString.c_str(), &amp;outString[ 1 ], length );
  
              outString[ 0 ] = length;
      }
  }
  </code></pre>
  
  <p>I wanted to make a call like:</p>
  
  <pre><code>IC_Utility::CP_StringToPString(directoryNameString, directoryName );
  </code></pre>
  
  <p>But I get an error:</p>
  
  <pre><code>error: cannot declare member function 'static void IC_Utility::CP_StringToPString(std::string&amp;, unsigned char*)' to have static linkage
  </code></pre>
  
  <p>I dont understand why I cannot do this. Can anyone help me understand why and how to achieve what I want?</p>