title: type name not allowed, accessing constant variable from main()
body: <p>constants.h</p>
  
  <pre><code> #include &lt;string&gt;
  class constants
  {
      static std::string FILE_PATH;
  };
  </code></pre>
  
  <p>constants.cpp</p>
  
  <pre><code>#include "constants.h"
  
  class constants{
  public:
      std::string constants::FILE_PATH = "G:\\TextFile.txt";
  };
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>#include "txtFileGenerator.h"
  #include "constants.h"
  int main(){
      txtFileGenerator(constants.FILE_PATH);
  }
  </code></pre>
  
  <p>Hello, given the above three files, why cant i access the public static string variable using constants.FILE_PATH? i get a "type name not allowed" error.</p>
  
  <p>Solution:</p>
  
  <p>main.cpp</p>
  
  <pre><code>#include "txtFileGenerator.h"
  #include "constants.h"
  
  std::string constants::FILE_PATH = "G:\\TextFile.txt";
  
  int main(){
      txtFileGenerator(constants::FILE_PATH);
  
  }
  </code></pre>
  
  <p>constants.h</p>
  
  <pre><code>#include &lt;string&gt;
  class constants
  {
  public:
       static std::string FILE_PATH;
  };
  </code></pre>