title: Compilation error while using to_string in c++ program
body: <p>To get precision and scale of a number i am using this simple program. But while converting number into string it is giving compilation error.</p>
  
  <pre><code>g++ precision.cpp
  precision.cpp: In function ‘int main()’:
  precision.cpp:6: error: ‘to_string’ was not declared in this scope
  </code></pre>
  
  <p>When I compile with the <code>-std=c++0x</code> switch I get</p>
  
  <pre><code>g++ precision.cpp  -std=c++0x
  precision.cpp: In function ‘int main()’:
  precision.cpp:6: error: call of overloaded ‘to_string(int)’ is ambiguous
  /usr/lib/gcc/i686-redhat-linux/4.4.4/../../../../include/c++/4.4.4/bits/basic_string.h:2604: note: candidates are: std::string std::to_string(long long int)
  /usr/lib/gcc/i686-redhat-linux/4.4.4/../../../../include/c++/4.4.4/bits/basic_string.h:2610: note:                 std::string std::to_string(long long unsigned int)
  /usr/lib/gcc/i686-redhat-linux/4.4.4/../../../../include/c++/4.4.4/bits/basic_string.h:2616: note:                 std::string std::to_string(long double)
  </code></pre>
  
  <p>The source code looks like this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  int main()
  {
      string value = to_string(static_cast&lt;int&gt;(1234));
      int precision = value.length();
      int scale = value.length()-value.find('.')-1;
      cout &lt;&lt; precision &lt;&lt; " " &lt;&lt; scale;
      return 0;
  }
  </code></pre>
  
  <p>What is causing this error?</p>