title: g++ 'stod' was not declared in this scope
body: <p>I am trying to compile the following code using g++ (version 4.8.1) in cygwin, and it seems that it cannot use the function stod():</p>
  
  <pre><code>//test.cpp
  #include&lt;iostream&gt;
  #include&lt;vector&gt;
  #include&lt;string&gt;
  using namespace std;
  
  int main(){
      string a="1.23";
      cout&lt;&lt;stod(a);
      return 0;
  }
  </code></pre>
  
  <p>I keep getting this eroor:</p>
  
  <pre><code>test.cpp:9:14: error: 'stod' was not declared in this scope
    cout&lt;&lt;stod(a);
  </code></pre>
  
  <p>I read another thread that has the same problem. There, people suggested to use c++11 to address it. So I tried both the following commands to compile it but still got the same error:</p>
  
  <pre><code>g++ -std=c++0x test.cpp -o test
  g++ -std=c++11 test.cpp -o test
  </code></pre>
  
  <p>Does anyone know a solution to this problem?</p>
  
  <p>And how do I know that c++11 is enabled? Do I need to modify my code in order to use it?</p>
  
  <p>Thanks a lot!</p>