title: Expected unqualified id before “.” token
body: <p>I see the above question(and similar questions) are answered at various places <a href="https://stackoverflow.com/questions/39891620/expected-unqualified-id-before-token">here</a>, <a href="https://stackoverflow.com/questions/25096804/expected-unqualified-id-before-token">here</a> and <a href="https://stackoverflow.com/questions/37222415/expected-unqualified-id-before-token">here</a>, but none of them explains what I am really after.</p>
  
  <p>I also saw a very good explanation of qualified / Un-qualified -id <a href="https://stackoverflow.com/questions/7257563/what-are-qualified-id-name-and-unqualified-id-name">here</a>.
  Here is my code, I am experimenting with static variables defined in the <code>struct</code>.</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;stdio.h&gt;
  #include&lt;string&gt;
  
  using namespace std;
  struct  foo {
    static  string name ;
  };
  string foo::name{"Warrior_Monk"};
  
  
  int main(){
  cout&lt;&lt;"foo::name is "&lt;&lt;foo::name&lt;&lt;endl;
  
  //Chaging the name , and then calling the second name through  a **temp** object which will be created 
  foo.name ="Great_Warriror_Monk"; // error:expected unqaulified-id before '.' token
  
  //foo::name ="Great_Warriror_Monk";  // THIS IS  THE FIX
  foo temp ; 
  cout&lt;&lt;"foo::name is "&lt;&lt;temp.name&lt;&lt;endl;
  cout&lt;&lt;"foo::name is "&lt;&lt;foo::name&lt;&lt;endl;
      return 0 ; 
  }
  </code></pre>
  
  <p>Now inside the main(), I unsuccessfully tried to change the static variable <code>name</code> with the command:</p>
  
  <pre><code>foo.name ="Great_Warriror_Monk";
  </code></pre>
  
  <p>for which GCC gave me the error:</p>
  
  <pre><code>error:expected unqaulified-id before '.' token
  </code></pre>
  
  <p>I know the fix is:</p>
  
  <pre><code>foo::name ="Great_Warriror_Monk"
  </code></pre>
  
  <p>But I am more inclined towards understanding the error. The error says that it expected an <code>unqualified-id</code> before the <code>'.'</code> token. From my understanding of unqualified id from <a href="https://stackoverflow.com/questions/7257563/what-are-qualified-id-name-and-unqualified-id-name">here</a>, struct <code>foo</code> well qualifies as an unqualified-id. So does it mean the error is incorrect with its wordings?</p>